Added Error handling to lambdas