swauth-related code refactored into separate class