move db module into a class instance