New function for update on save