refactored the logger