changed edit function