restructure before edit