Added code to ensure database properly set up