Now working on an idea of using a quadtree to represent the wires. So wire segments are the sides of square that can have varying size. This makes it fast to find a segment being clicked on and branch wires, but then rebuilding the tree when moving wires/bends is nightmare.