refactor client out to separate class