Tweaks to bring code in line with tutorial.