debugged the edit functions