update for UF algorithm