DB to the rescue! It's certainly a fiddly problem. I think you made the right decision.

cheers,
Gav.