Tweaked tutorial code