This function is identical to the previous one with the exception of one line. It would be nicer to extract the range check into a separate function.