Extract unspecified-index detection to method