moving database into its own class