union find combined, working well, pause occasinally