ported to newer, more efficient v8 api