edit logic