Edit logic