fixing November 9th merge issues, code style fixes, small refactrorings

redone all merging since 1.6 :)