working lambda code

the lambda code works, but does not do exactly what it is supposed to.