Update main.js

Added a ton of comments.