Simplify locking scheme. Don't use recursive mutex when unnecessary