cleaned the code and added cluster center stuff