added code for getRidsInRange