fixed up file IO, kmeans still has some bugs