OPT: Made the following changes
1. Prevent recomputing centroids.