Moving v8 execution to a separate method