Hi Nick,
All this type of code that needs to constantly run is normally just added to a forever loop at the end of the initialization program. The system then initializes and then continues looping monitoring the MPG, eStop, switch inputs, etc...
Regards