Move some logic out of the client class