Set prevWord = curWord in the checkDupes function.