changed closestStore method

made it dynamic for range