refactored one of the lambdas