refactored several locks
removed infinite recursion candidate with retry loop stopping after 100 tries