Major update of the sectormaker code