edit logic - some refinement