rearranging an onupdate