reimplent parser for line by line parsing