this should be: `case Some(batchID) if batchID <  exclusiveUB` right? Your code would never match because the method is returning Option[BatchID].

Please avoid case _, because it won't error in such cases of total matches (this should be case Some(x) => and case None =>)