Get rid of db struct. Start cleaning up the different state functions and
moving some of the validation into its own type.