got the edit function working