Factor out a ClientManager, minor cleanup