Change code to group simulations