some typos in comments corrected