added clustering codes