fixing typos, cleaning up code and examples