added clustering functions