Added the final averaged dataset and file output