Multilevel indentation improved. Correctly handle all cases and print correct error messages: