Some dodgy code in there, global 'result' var, fixed.  Also, pass values to the extend, seems like that is required otherwise values don't seem available
Merge pull request #2 from evadnoob/master

Some dodgy code in there, global 'result' var, fixed.  Also, pass values...