Refactored the Parser class.