refactored parser stuff