minor changes to apply and reduce