refactor client to use single connection (wip)