tweaked thread and function logging