Updated with Discussion 04 code.