Corrected main script.