Refactored authentication on client to support multiple connections