Fixed typos in comments and neatened up code blocks