Refactor Parser class