Update indentation. error messages added. global variable accessing nonexisting local variable is captured.