Switched from sqlite to postgresql for the database, and added logging.