changing gindex to globalIndex for clarity