Fixed coding style

Mostly fixed trailing whitespaces, bad visual indentation and unused
imports.