Any reason this is not power of 2?  I would use power of 2 and use bitwise AND to get a remainder in `index()`.