Some more code cleanup. DB creation is now functionalized in case it needs to be reused