added a update method and also logic to call it