Added some stuff for keeping the database connection alive.