refactored parser class