gol.js: Add some explanatory comments

...and minor refactor