Refactored logging for readability