working on update function