minor refactorings and logger added