rewrite of main.js to index.js
added pics