Better use of ranges