I\'ve written a better version of this snippet since I uploaded it. I\'ll post that soon. This one seems to have a few problems.