Ch.4 code edits based on reviewer feedback