Remove all trailing on each line whitespace first

This makes further processing and fine-grained handling for other
whitespace a lot easier. Removed some trim()s which are no longer
necessary.