Optimized.

Gets around 350,000 transitions per run.