Fixed a lot of bugs during todays patching. The script wasn't working properly at all but now it's doing its work much better.