also adjusted edit function