Small refactors

In preparation for db hookup.