fixed parser to recognize both crlf and lf and accept trailing spaces