added rolling average for euclidean distance and solved memory leak of vectors