I have reached the point in the programming day where it is time to put this problem down for a while and let my brain chew on it. I think I will go chew on dinner instead. (This is a lovely little problem that I suspect is ideally solved by recursion, but I have not yet figured out how to set things up so that the recursion will do what I actually want it to. Dinner should help. :) )