corrected main block