Rewritten script to use v8 api. Now works again