Thanks jonsey, thats one of the bad habbits I have that I was talking about above, its fixed now. I noticed another == 0 and two more != $nulls that I got rid of too.
I just wish I could have got the regex to work for me for the right bracket check. I ended up using the method in my code because no matter what I did I couldnt get the right bracker search regex I came uo with catch the second } in } } but it caugth it EVERYWHERE else I needed it to. Thats the one part of this code I do personally think could be better. Dont get me wrong, it works just fine, its just if I had nailed the regex the code would be a few lines smaller.
Anyhow, thanks for the comment. I really need to break myself of that habbit and I think I finally will.
edit
On a closer look I found quite a few more if $v1 == $null or != $null or == 0 that I also fixed. Told ya it was a bad habbit. Those must be the horribly messy coding that Lindrian was talking about. Im just a horrible person I know. Lol :P
edit