Ok, looks like a few people read the post, but I can only guess why there's no replies
Anyways, I've converted the really-messy-pseudocode into not-quite-as-messy code (I hope).....anyways, obviously a work in progress, but still any feedback would be cool
http://wow.pastebin.com/655150