I wrote a different version of ns_returnredirect that might be useful in your situation. You would have to adapt it. The link is http://zmbh.com/vat/vat.txt.