Remove trailing whitespace, break long lines and remove unused code