refactor closure