some basic refactorings, implemented more on ASTGenerator