Update javascript/main.js

Set comments on where I used factory. It is an amazing shortcut :)