Refactor parsing code to create Parser once and reuse in other place (#2)