refactored the writing of response data to files
finished k-means cluster update method