rewiring the structure