add --version argument

also took the liberty to:

* move out all command line options into one function (main is getting big)
* fixed some return values when an error has occured
* removed cleanup of the db completely since the process exits anyway