ergodic,
Thanks for taking the time to rework the post. It's a great reference and I have already used your approach to solve an otherwise messy problem.
ergodic - Thanks for checking. It's still a useful post even without 100% coverage on the code. Maybe the edits will magically reappear someday and save you the trouble of rewriting it.