recipe ch03-04 cleaned up and added comments