Correct he `function` in the examples and fixed a few minor spelling errors

Just changes to the documentation