refactor closure application