move dbinit code into module