Migrating kmeans to model class