Move index code into index.js.