using copy of  KT's code for clustering test