huge refactoring: methods moved to classes, major logging improve

set overall loglevel from command line