Major rewrite to allow for better local search.

* Facor out DB and Config into modules
* Unify local and remote search to a larger extent
* Divide CLI into subcommands