Sorry I didn't look closer before, but couldn't this be an argumentless lambda and just reference the existing cmd variable?