Prune whitespace and add trailing newlines

This shit is important.