Added example 5-13. Code needs a little cleaning and testing, but still works OK.