Move some things into a separate db.go