Many small fixes in gh-index.js

(optimizations, missing ';', removal of duplicate code)