Better error handling, error checking via SQLite database