ex6 finished; all tests pass