Added multi-dimensional kmeans function