Moves the database into the db folder.
Refactors out the database connection logic.