split out database stuff into its own file