Small change to Model instantiation
Changed how the DB config is selected and fixed some bugs