Put mode in its own table, explicit function to change it

This is very much still in progress, pull request just for review as I go along.

Ultimate aim is to fix this bug, am taking chance to refactor code.
https://github.com/scraperwiki/twitter-search-tool/issues