coding, rework edit function