Fixed database creation for new setup so that it correctly traps errors if the database already exists, etc.