refactoring, add log messages