refactor wiring out