Much refactoring in simulation helpers.