update code examples to have titles and reflect latest edits of book draft