refactored formula handling
prettified parser code