make a findset function to contain while