Gkey refactoring