Improve client db

this adds the functionality mentioned in #7 
this is error checking code. I'm not expecting a space, but I want to do extra error handling just in case (if the alternative is either an overflow or losing data, more error checking is worth it)