updated parser to support file format with trailing spaces