Better error messages
Crash fix

I refactored the database operations, so there was less awkwardness in
the code.