Getting org switcher functional and related refactorings, fixes #2189.