More refactoring of the AST creation