Corrected the sector function