Update index.js and tests