Refactor to use twdb library.
Produce better output for heroku logs.