edit function now working