chapter 9 exercises, various test additions and refactor
s