change to line reading
perform whitespace removal using map