upgrade AST implementation