Heh, did a quick tweak after i noticed that $1 was never set. a float on each line seems to have done the trick. edit2: oops, integer not float...
I'll test it out tomorrow and let you know what I see.