ex 9-4 almost works correctly.