Added proper object matching, and some other things:

* logout / quit commands
* cleaned up some crusty code
* added async db saving