Refactored NotOutOfRange methods for better static code analysis