Updating code to reflect Nigel's most recent changes to book