Core utility routines used throughout the simulator.