added changes proposed by max up to chapter 3