finished example code and MM in section 3, chapter7