Update main.js

code review