Added db selection logic to root path