added edit logic