Cleanup slave/master calculation code
Cleanup Magpie_calculate_stop_timeouts code