shifted demo code to index.js

and a few general maintenance items