Updated simulation code to save temporary batches and return a structure instead of a huge list of arrays