Update main.js

added debugging EVERYWHERE!!!