Corrected errors in main