Added implementation for IsInRange