add logger
refactoring