huge refactoring: methods moved to classes, major logging improve

ow, my bad.
In this case it's ok