updated functions with lambdas