Implement chapter 8 exercises