Ch. 8: refactor