Moving main script to index.js