Improve mode changing
The mode changing code is still somewhat specific to i4 infrastructure. It should be generalized to allow others to use a different set of modes.
Also it currently only tracks changes that happen through obinex. Which means that on startup the mode has to be set manually for it to function correctly. However detecting the mode automatically needs to be implemented with the above generalization in mind.