WIP: converting main.js
Moves main and shim to js/
WIP: Further adaptations for main.js