edit function updated