restructuring, adding logger-code