Changed AST representation, removed recursive methods, increased performance