Corrected indentation in main loop