Initial checkin of KMeans implementation

Basic framework for KMeans implementation and code refactoring.
Reverting back to the old code for KMeans