Coding the update method.v