curve splitting and wire code reorganization