Added encodeWords() function!