Continued adapting the add function to make it an edit function