merge and clear