huge refactoring: methods moved to classes, major logging improve

Ok