Refactor generator internals; start adding label helpers