edited to use new clustering function;