Confusing with local bool havePrevious and also this HavePrevious -- or is the capitalised one just a typo?