Pull this duplicate statement out before the if blocks.