Changed edit function