refactor parser utility