corrected main method