extracted utility method, added log line