ValuOutOfRangeException refactor