Some more rewriting based on @anselmbradford pattern suggestion. Deprecate all instances of menu visibility global var and _hideMenus() global function