Fixed typos
Added comment for a piece of confusing code