Added updateGlobals function to replace the SM module that didn't want to cooperate.