Improve the implementation of GHOG (C# version).