Adapted to the new database connect model