updated cell edit logic