End of Chapter 4 with fixes