Don't use an explicit out-of-bounds class
Extract bsearch header calculation into a function
Use some scoping within indexof function
Extract the code behind lookup array segmentation