remove trailing whitespace
fix a few style problems