shifted demo code to index.js