setting up database and flashes