Adding getWords method.