Reduce the use of lambda functions