Register to party and in "Primary" elections only then have a one primary cycle lock out on change of party voters. IOW no changing parties in May to go vote in the other parties primaries and change back in time for next primary. A one Primary Lock Out of the upcoming primary from time of change of party would stop the nonsense.
We also need, as I’ve said many times, a pre-party convention to choose nominees to appear on the ballot and weed out the kooks, the phonies and the ringers (and with that, out goes Willard, McQueeg, Lamar! & Thad the Cad). I don’t think we should even have candidates declaring to run, they should be popularly drafted, called upon to run. 9 out of 10 people that choose to run are usually the last people I’d ever want to see in office, and that’s probably understating it.