Refactored to allow use of other external simulators