Add logic to avoid jumping forth and back between shared states, also update execution status before switching context