put main code into index.js