added global 'App' namespace and tidied up connectivity fsm