Refactored parser to be a class instead of a global