Completed the gpgs logic.