Finished k means implementation