use closures instead of parameters