Changed parsing routine to line-by-line