SSO refactoring