refactor of parser2