added some utils and did a quick binary search