cleaned up database handling, added startupcheck to see if database exists