More lambdas

Converted some of the for loops to use lambdas instead.