refactored ast