I took a look at this script and I freaked out for a sec thinking...did i actually use to code this way? I FIXED IT THOUGH! :D
Anyway, this script is now ready for the new AGFile which can be downloaded here: http://www.hawkee.com/snippet/8236/