Fixed binary search

+Added a '- 1' to the parameter when binarySearch is called to fix an
IndexOutOfBounds error.