added clustering functionality