Can you pull fetching the gp out of the if clauses so that you don't duplicate this logic 3 times