Another way to do it would to be to package over the specific datablock's onadd(so you don't have to do all the checking to make sure it's the right datablock).
Anyways, megascience, your issue is that you stuff some stuff together, don't test it, don't check for syntax, don't even indent correctly, and then get pissed off when Ephi comes along and posts a working code.
You shouldn't be giving help if you aren't going to take the time to make sure its relatively correct.