remove cruft; add trailing newlines back