Added code for update event