fixed some typos. Formatted code