I'm not sure this logic is correct if the bid is a jump support of partner's suit. Since then there's only one possible bid here, we don't need any complicated priorities and can simplify this whole thing. Can you do that, or strip this out and we'll pair on this tomorrow?