Refactored Logging.hs to Database.hs; various other refactors.
Added database.hs since it was accidentally omitted from previous commit
Added Database.hs yet again