Refactor some Database stuff into packages.