working on new simulation loop