cluster finding algorithm implemented