Refactor db client, connections