Gneiss.build() and its calls no longer depend on Gneiss.g being set

Refactored Gneiss.build() and its calls so they no longer depend on
references to the Gneiss.g global, but rather act on an input param.
This is part of a larger refactor to scope data better and build
helpers that act upon the data.

Other general code cleanup (indentation, semicolons).