added log calls for debugging