Created db inside function