Rewrote device modes to move observers to the model for reuse in other scripts.