refactored logging functions