Added Sorting and Average