Some documentation fixes

Tried to beautify the inline documentation and fix some errors. No functional changes
Probably it would be even more readable if we replace `If it is defined,` with `If yes,` to avoid duplicating words.