Use closures instead of a function type.