Refactor lock handling