refactored ast out