added error checks to inRange()