Added easier support for Flashes
Moving DB access (as much as possible) into `db` package.