worked on update function a bit more