ME: replaced 'export_handler' with 'custom_response_handler'
ME: code refactor; created a separate function to handle logs