closure refactoring