Moved executing of lambdas outside mutex locks.