Fixed bug where while loop would not quit due to startPos and endPos being both 0.