Code tweaks to the book