added log message on start, lifted function to top