Changed to make writing excel files more RAM optimal