Remove extra debug info, add comments'
Move running of function outside of the lock