added binary search to reference.cpp's getStretch