Added code to calculate the cosine distance matrix and to preprocess(normalize) the data.