Update main.js

Added to chrome, fixed bugs