Improve switching code for J3 and J2