simplify `state` calculation in `update`