updated cluster sorting