added log output, caching