Revert "Removed db passing around"

This reverts commit 675fc87f25cea43260f5f2fcffafabe5e0708207.