Added State Pattern to reflect online and offline mode.