abstracted db constructor

cleans up autocomplete too