Improve client db

this adds the functionality mentioned in #7 
can you put all this db calls in a function called `init_db` or something?