Improve bRange() function