added function to update