Added comments in JS script + reorganizing it a bit
Merge pull request #67 from Phyks/greatRefactor

Added comments in JS script + reorganizing it a bit