Change lambda-able functions to use lambdas