Added assert statements. Corrected spelling errors.