Fixed a few style things and updated to autoreconnect to the database on close