added log printing, etc