Corrected some typos and errors in the code.