Changes to edit function