database client refactoring