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