refactor the db file and loading of db config