Attaching a second version of the patch, added missing import and lambda.