changed getRange function implementation