use a function with arguments instead of a new closure for each functional invocation