Checking in sometwhat working code from chapter 4