update index.js

added multi threading