improve lambda function