diff --git a/asterix-aql/src/main/javacc/AQL.jj b/asterix-aql/src/main/javacc/AQL.jj
index fd0ae52..aa2da9e 100644
--- a/asterix-aql/src/main/javacc/AQL.jj
+++ b/asterix-aql/src/main/javacc/AQL.jj
@@ -158,13 +158,13 @@
 
 DataverseDecl DataverseDeclaration() throws ParseException:
 {
-  Identifier dvName = null;
+  String dvName = null;
 }
 {
   "use" "dataverse" dvName = Identifier()
     {
-      defaultDataverse = dvName.getValue();
-      return new DataverseDecl(dvName);
+      defaultDataverse = dvName;
+      return new DataverseDecl(new Identifier(dvName));
     }
 }
 
@@ -223,8 +223,8 @@
 
 NodegroupDecl NodegroupSpecification() throws ParseException:
 {
-  Identifier name = null;
-  Identifier tmp = null;
+  String name = null;
+  String tmp = null;
   boolean ifNotExists = false;
   List<Identifier>ncNames = null;
 }
@@ -233,15 +233,15 @@
   ifNotExists = IfNotExists() "on" tmp = Identifier()
     {
       ncNames = new ArrayList<Identifier>();
-      ncNames.add(tmp);
+      ncNames.add(new Identifier(tmp));
     }
   ( "," tmp = Identifier()
     {
-      ncNames.add(tmp);
+      ncNames.add(new Identifier(tmp));
     }
   )*
     {
-      return new NodegroupDecl(name, ncNames, ifNotExists);
+      return new NodegroupDecl(new Identifier(name), ncNames, ifNotExists);
     }
 }
 
@@ -249,12 +249,12 @@
 {
   Pair<Identifier,Identifier> nameComponents = null;  
   boolean ifNotExists = false;
-  Identifier typeName = null;
+  String typeName = null;
   String adapterName = null;
   Map<String,String> properties = null;
   FunctionSignature appliedFunction = null;
   List<String> primaryKeyFields = null;
-  Identifier nodeGroupName = null;
+  String nodeGroupName = null;
   Map<String,String> hints = new HashMap<String,String>();  
   DatasetDecl dsetDecl = null;
 }
@@ -269,7 +269,13 @@
         ExternalDetailsDecl edd = new ExternalDetailsDecl();
         edd.setAdapter(adapterName);
         edd.setProperties(properties);
-        dsetDecl = new DatasetDecl(nameComponents.first, nameComponents.second, typeName, hints, DatasetType.EXTERNAL, edd, ifNotExists);
+        dsetDecl = new DatasetDecl(nameComponents.first,
+                                   nameComponents.second,
+                                   new Identifier(typeName),
+                                   hints,
+                                   DatasetType.EXTERNAL,
+                                   edd,
+                                   ifNotExists);
       } 
 
     | "feed" <DATASET> nameComponents = QualifiedName()
@@ -280,8 +286,20 @@
     ( "on" nodeGroupName = Identifier() )?
     ( "hints" hints = Properties() )?
       {
-        FeedDetailsDecl fdd = new FeedDetailsDecl(adapterName, properties, appliedFunction, nodeGroupName, primaryKeyFields);
-        dsetDecl = new DatasetDecl(nameComponents.first, nameComponents.second, typeName, hints, DatasetType.FEED, fdd, ifNotExists);
+        FeedDetailsDecl fdd = new FeedDetailsDecl(adapterName,
+                                                  properties,
+                                                  appliedFunction,
+                                                  nodeGroupName != null
+                                                    ? new Identifier(nodeGroupName)
+                                                    : null,
+                                                  primaryKeyFields);
+        dsetDecl = new DatasetDecl(nameComponents.first,
+                                   nameComponents.second,
+                                   new Identifier(typeName),
+                                   hints,
+                                   DatasetType.FEED,
+                                   fdd,
+                                   ifNotExists);
       }
     | <DATASET> nameComponents = QualifiedName()
     <LEFTPAREN> typeName = Identifier() <RIGHTPAREN>
@@ -289,8 +307,17 @@
     primaryKeyFields = PrimaryKey() ("on" nodeGroupName = Identifier() )?
     ( "hints" hints = Properties() )?
       {
-        InternalDetailsDecl idd = new InternalDetailsDecl(nodeGroupName, primaryKeyFields);
-        dsetDecl = new DatasetDecl(nameComponents.first, nameComponents.second, typeName, hints, DatasetType.INTERNAL, idd, ifNotExists);
+        InternalDetailsDecl idd = new InternalDetailsDecl(nodeGroupName != null
+                                                            ? new Identifier(nodeGroupName)
+                                                            : null,
+                                                          primaryKeyFields);
+        dsetDecl = new DatasetDecl(nameComponents.first,
+                                   nameComponents.second,
+                                   new Identifier(typeName),
+                                   hints,
+                                   DatasetType.INTERNAL,
+                                   idd,
+                                   ifNotExists);
       }
   )
     {
@@ -301,8 +328,8 @@
 CreateIndexStatement IndexSpecification() throws ParseException:
 {
   CreateIndexStatement cis = new CreateIndexStatement();
-  Identifier indexName = null;
-  Identifier fieldExpr = null;
+  String indexName = null;
+  String fieldExpr = null;
   boolean ifNotExists = false;
   Pair<Identifier,Identifier> nameComponents = null;
   IndexParams indexType = null;
@@ -311,17 +338,17 @@
   "index" indexName = Identifier()
   ifNotExists = IfNotExists()
   "on" nameComponents = QualifiedName()    
-  <LEFTPAREN> ( <IDENTIFIER>
+  <LEFTPAREN> ( fieldExpr = Identifier()
     {
-      cis.addFieldExpr(token.image);
+      cis.addFieldExpr(fieldExpr);
     }
-  ) ("," <IDENTIFIER>
+  ) ("," fieldExpr = Identifier()
     {
-      cis.addFieldExpr(token.image);
+      cis.addFieldExpr(fieldExpr);
     }
   )* <RIGHTPAREN> ( "type" indexType = IndexType() )?
     {
-      cis.setIndexName(indexName);
+      cis.setIndexName(new Identifier(indexName));
       cis.setIfNotExists(ifNotExists);
       cis.setDataverseName(nameComponents.first);
       cis.setDatasetName(nameComponents.second);
@@ -374,7 +401,7 @@
 
 CreateDataverseStatement DataverseSpecification() throws ParseException :
 {
-  Identifier dvName = null;
+  String dvName = null;
   boolean ifNotExists = false;
   String format = null;
 }
@@ -387,7 +414,7 @@
     }
   )?
     {
-      return new CreateDataverseStatement(dvName, format, ifNotExists);
+      return new CreateDataverseStatement(new Identifier(dvName), format, ifNotExists);
     }
 }
 
@@ -484,16 +511,17 @@
 
 List<String> PrimaryKey() throws ParseException:
 {
+  String tmp = null;
   List<String> primaryKeyFields = new ArrayList<String>();
 }
 {
-  "primary" "key" <IDENTIFIER>
+  "primary" "key" tmp = Identifier()
     {
-      primaryKeyFields.add(token.image);
+      primaryKeyFields.add(tmp);
     }
-  ( "," <IDENTIFIER>
+  ( "," tmp = Identifier()
     {
-      primaryKeyFields.add(token.image);
+      primaryKeyFields.add(tmp);
     }
   )*
     {
@@ -503,7 +531,7 @@
 
 Statement DropStatement() throws ParseException:
 {
-  Identifier id = null;
+  String id = null;
   Pair<Identifier,Identifier> pairId = null;
   Triple<Identifier,Identifier,Identifier> tripleId = null;
   FunctionSignature funcSig = null;
@@ -523,7 +551,7 @@
       }
     | "nodegroup" id = Identifier() ifExists = IfExists()
       {
-        stmt = new NodeGroupDropStatement(id, ifExists);
+        stmt = new NodeGroupDropStatement(new Identifier(id), ifExists);
       }
     | "type" pairId = FunctionOrTypeName() ifExists = IfExists()
       {
@@ -531,7 +559,7 @@
       }
     | "dataverse" id = Identifier() ifExists = IfExists()
       {
-        stmt = new DataverseDropStatement(id, ifExists);
+        stmt = new DataverseDropStatement(new Identifier(id), ifExists);
       }
     | "function" funcSig = FunctionSignature() ifExists = IfExists()
       {
@@ -642,11 +670,7 @@
   String pv = null;
 }
 {
-  "set" <IDENTIFIER>
-    {
-      pn = token.image;
-    }  
-  <STRING_LITERAL>
+  "set" pn = Identifier() <STRING_LITERAL>
     {
       pv = removeQuotesAndEscapes(token.image);
       return new SetStatement(pn, pv);
@@ -655,7 +679,7 @@
 
 Statement WriteStatement() throws ParseException:
 {
-  Identifier nodeName = null;
+  String nodeName = null;
   String fileName = null;
   Statement stmt = null;
   Query query;
@@ -674,7 +698,7 @@
       }
     )?
       {                  
-        stmt = new WriteStatement(nodeName, fileName, writerClass);         
+        stmt = new WriteStatement(new Identifier(nodeName), fileName, writerClass);         
       }
   ) | (
     "into" <DATASET> 
@@ -723,11 +747,7 @@
   String adapterName = null;
 }
 {
-  (<IDENTIFIER>
-    {
-      adapterName = token.image;
-    }
-  | <STRING_LITERAL>
+  ( adapterName = Identifier() | <STRING_LITERAL>
     {
       adapterName = removeQuotesAndEscapes(token.image);
     }
@@ -837,11 +857,7 @@
   String value;
 }
 {
-  <IDENTIFIER>
-    {
-      key = token.image;
-    }
-  "=" ( <STRING_LITERAL>
+  key = Identifier() "=" ( <STRING_LITERAL>
     {
       value = removeQuotesAndEscapes(token.image);
     }
@@ -923,7 +939,7 @@
         boolean nullable = false;
 }
 {
-      <IDENTIFIER>
+      fieldName = Identifier()
       	{
 	     fieldName = token.image;	     	     
          String hint = getHint(token);
@@ -979,12 +995,12 @@
 
 TypeReferenceExpression TypeReference() throws ParseException:
 {
-  Identifier id = null;
+  String id = null;
 }
 {
  id = Identifier()
    {
-     return new TypeReferenceExpression(id);
+     return new TypeReferenceExpression(new Identifier(id));
    }
 }
 
@@ -1030,53 +1046,61 @@
     }
 }
 
-Identifier Identifier() throws ParseException:
+String Identifier() throws ParseException:
 {
 }
 {
   <IDENTIFIER>
     {
-      return new Identifier(token.image);
+      return token.image;
     }
 }
 
 Pair<Identifier,Identifier> QualifiedName() throws ParseException:
 {
-  Identifier first = null;
-  Identifier second = null;
+  String first = null;
+  String second = null;
 }
 {
   first = Identifier() ("." second = Identifier())?
   {
+    Identifier id1 = null;
+    Identifier id2 = null;
     if (second == null) {
-   	  second = first;
-   	  first = null;
-    } 
-    return new Pair<Identifier,Identifier>(first,second);
+      id2 = new Identifier(first);
+    } else
+    {
+      id1 = new Identifier(first);
+      id2 = new Identifier(second);
+    }
+    return new Pair<Identifier,Identifier>(id1, id2);
   }  
 }  
   
 Triple<Identifier,Identifier,Identifier> DoubleQualifiedName() throws ParseException:
 {
-  Identifier first = null;
-  Identifier second = null;
-  Identifier third = null;
+  String first = null;
+  String second = null;
+  String third = null;
 }
 {
   first = Identifier() "." second = Identifier() ("." third = Identifier())?
   {
+    Identifier id1 = null;
+    Identifier id2 = null;
+    Identifier id3 = null;
     if (third == null) {
-   	  third = second;
-   	  second = first;
-      first = null;
-    } 
-    return new Triple<Identifier,Identifier,Identifier>(first,second,third);
+      id2 = new Identifier(first);
+      id3 = new Identifier(second);
+    } else {
+      id1 = new Identifier(first);
+      id2 = new Identifier(second);
+      id3 = new Identifier(third);
+    }
+    return new Triple<Identifier,Identifier,Identifier>(id1, id2, id3);
   }  
 }  
 
-
-  
-
 FunctionDecl FunctionDeclaration() throws ParseException:
 {
   FunctionDecl funcDecl;
@@ -1089,11 +1113,7 @@
   createNewScope();
 }
 {
-  "declare" "function" <IDENTIFIER>
-  {
-    functionName = token.image;
-  }
-  <LEFTPAREN> (<VARIABLE>
+  "declare" "function" functionName = Identifier() <LEFTPAREN> (<VARIABLE>
     {
       var = new VarIdentifier();
       var.setValue(token.image);
@@ -1441,12 +1461,12 @@
 
 Identifier Field() throws ParseException:
 {
-  Identifier ident = null;
+  String ident = null;
 }
 {
   "." ident = Identifier()
     {
-      return ident;
+      return new Identifier(ident);
     }
 }
 
@@ -1743,27 +1763,45 @@
   List<Expression> argList = new ArrayList<Expression>();
   String funcName;
   String dataverse;
+  String arg1 = null;
+  String arg2 = null;
   LiteralExpr ds;
-  LiteralExpr dvds;
   Expression nameArg;
   int arity = 0;
 }
 {  
-    <DATASET> {dataverse = MetadataConstants.METADATA_DATAVERSE_NAME; funcName = token.image;}
-    (
-    (<IDENTIFIER> {ds = new LiteralExpr(); ds.setValue( new StringLiteral(token.image) ); argList.add(ds); arity ++;} ("." <IDENTIFIER> { dvds = new LiteralExpr(); dvds.setValue(new StringLiteral(ds.getValue()+"."+token.image)); argList.remove(0); argList.add(dvds);})? ) |  
-    (<LEFTPAREN> nameArg = Expression() {argList.add(nameArg); arity ++;} ("," nameArg = Expression() { argList.add(nameArg); arity++; })* <RIGHTPAREN>)
-    )  
-     
-     {
-       FunctionSignature signature = lookupFunctionSignature(dataverse, funcName.toString(), arity);
-       if(signature == null)
-             {
-                signature = new FunctionSignature(dataverse, funcName.toString(), arity);
-             }
-       callExpr = new CallExpr(signature,argList);
-       return callExpr;
+  <DATASET>
+    {
+      dataverse = MetadataConstants.METADATA_DATAVERSE_NAME;
+      funcName = token.image;
+    }
+  ( ( arg1 = Identifier() ( "." arg2 = Identifier() )? ) 
+    {
+      String name = arg2 == null ? arg1 : arg1 + "." + arg2;
+      ds = new LiteralExpr();
+      ds.setValue( new StringLiteral(name) );
+      argList.add(ds);
+      arity ++;
+    }
+  | ( <LEFTPAREN> nameArg = Expression()
+    {
+      argList.add(nameArg);
+      arity ++;
+    }
+  ( "," nameArg = Expression()
+    {
+      argList.add(nameArg);
+      arity++;
+    }
+  )* <RIGHTPAREN> ) )  
+   {
+     FunctionSignature signature = lookupFunctionSignature(dataverse, funcName, arity);
+     if (signature == null) {
+       signature = new FunctionSignature(dataverse, funcName, arity);
      }
+     callExpr = new CallExpr(signature,argList);
+     return callExpr;
+   }
 }
 
 Expression ParenthesizedExpression() throws ParseException:
