clean up cmeans and wordcount code