Finished edit function completely