Refactored main.js
Refactored main.js