Moved around some DB code.