getRange refactored