rewiring code