Implemented the excercises at chapter 6