improve readability and code style by indenting lines, cleaning up trail...

...ing whitespaces + some slight refactorings