Refactoring closure management