Use an ArrayRef to simplify repeated calculation of the array end. NFC