added calculation of range