Completed up to chapter 5 code