public String getResponseTo(String chatName, String sender, String thePhrase) {
        // Create new phrase for the statement uttered.
        Phrase phrase = new Phrase(sender, thePhrase);

        // Get chat object for this chat.
        Chat chat = getChatFromName(chatName);

        // Add phrase to chat.
        chat.addResponse(phrase);

        String response = "";

        // Determine response.
        if(phrasesReceived.size() > 1) {

            for(Phrase ph : phrasesReceived) {

                for(String s : phrase.getWords()) {
                    for(String t : ph.getWords()) {

                        if(s.equalsIgnoreCase(t)) {
                            response = ph.getResponseTo();

                            if(response == null) {
                                response = ph.getCompletePhrase();
                            }
                        }

                    }
                }
            }

            // If still no phrase has been found, just reply with a random phrase.
            if(response.equalsIgnoreCase("")) {
                Phrase phrase1 = phrasesReceived.get(new Random().nextInt(phrasesReceived.size() - 1));

                response = phrase1.getCompletePhrase();
            }
        } else {
            response = "I haven't been talked to enough to generate a reply!";
        }

        // Add it to bot.
        sayTo(sender, phrase);

        // Add response to chat.
        chat.sayIntoChat(new Phrase("cacbot", response));

        // Save bot to disk.
        save();

        // Return response.
        return response;
    }