Various patches

Mostly minor cleanups here and there, fixing some checkstyle warnings, indentation etc. 4c74cb6b is the only commit that should change the code in any way.