added code to copy wordSet contents into sortedWordSet in the main