Removed some superfluous lambdas in intermediate functions