huge refactoring: methods moved to classes, major logging improve

I think it will not add readability