write the update handler.