Minor changes to match book code