some refactoring with dbs