added logger, micro refactoring