added clustering algorithm