finish replacing functors with lambdas