Cleaned up displayRanges() function