Refactored Ranges
Added Logical Check