Typos and code mods

Please check carefully. I did this in a hurry.