remove trailing whitespace and reduce whitespace for organization purposes