fully working kmeans and tests - optimization and enhancement to follow