havent had a chance yet to check out your script but when i have time i will for sure. Here is a tip though that you may be able to use to optimize it though:

with 2wire routers using att uverse...