Sort out some confusion following mysql refactor
Start testing of database functions

And fix up a few other bits and bobs
Fix tasks test - docopt does system exit on help