use the newer reduce api