Looks like this was originally an inline function, judging from how this was repeated all over again.
validSectorIndex()