Some refactoring, started on kmeans++