edit function complete