wiring and refactoring