More refactoring to make simulation controllable from lessons