chapter 8 adding the marking algorithm