Refactoring locks