refactoring wire and segments