removed trailing whitespaces
some more minor refactorings