more logging and refactoring
Merge branch '1.3.5'