added log file functionality