Can you post a sample of the output of running the script? This might be interesting to see how it works.