Refactor Client and Transport