Separated DB stuff a little bit from the rest.