cleaning up code for AST