improve application of lambda function