Refactor parser class