Edits & improvements to programming guide.

This includes fixes for typos, grammar mistakes and clarifying a few confusing
sections.

Thanks to @fivemicro for edits and suggested improvements.