K-means proto type
code refactor