Remove unnecessary intermediate lambda functions