Optimize convertRange method