simpler wiring algorithm