Move these locals above the if check and use them there.