added all code up to (and including) page 114