Refactoring the Parser class