improved AST parsing