public void OnPhraseSelectGUI()
    {
        GUIF.Button(new Rect(Screen.width * 0.01f, Screen.height * 0.01f, Screen.width * 0.4f, Screen.height * 0.075f), "Back", () => {
            Application.LoadLevel("default");
            menuState    = MenuState.ListingSets;
            searchString = "";
            scrollPos    = new Vector2();
            scrollFling  = 0.0f;
        });
        string str;

        switch (mode)
        {
        case PlayMode.AlwaysInstant:
            str = "Always Play";
            break;

        case PlayMode.Override:
            str = "Override Playing";
            break;

        case PlayMode.Queue:
            str = "Queue";
            break;

        case PlayMode.Spam:
            str = "Spam";
            break;

        default:
            str = "Error";
            break;
        }
        GUIF.Button(new Rect(Screen.width * 0.59f, Screen.height * 0.01f, Screen.width * 0.4f, Screen.height * 0.075f), str, () => {
            NextMode();
        });
        Rect  scrollArea = new Rect(Screen.width * 0.01f, Screen.height * 0.2f, Screen.width * 0.98f, Screen.height * 0.73f);
        float lineHeight = GUI.skin.button.LineSize() * 1.33f;
        Rect  brush      = new Rect(Screen.width * 0.01f, Screen.height * 0.1f, Screen.width * 0.93f, lineHeight);

        GUI.Label(brush.Left(0.2f), "Search");
        searchString = GUI.TextField(brush.Right(0.8f), searchString);
        GUIF.Button(new Rect(Screen.width * 0.94f, Screen.height * 0.1f, Screen.width * 0.05f, lineHeight), "X", () => {
            searchString = "";
        });
        brush       = brush.Move(0.0f, 1.0f);
        brush.width = Screen.width * 0.98f;
        switch (sortMode)
        {
        case SortMode.Alphabetic:
            str = "Alphabetic";
            break;

        case SortMode.MostPlayed:
            str = "Most Played";
            break;

        case SortMode.SearchRelevance:
            str = "Relevance";
            break;

        default:
            str = "Error";
            break;
        }
        GUIF.Button(brush, "Sort by: " + str, () => {
            NextSortMode();
            scrollPos   = new Vector2();
            scrollFling = 0.0f;
            if (System.String.IsNullOrEmpty(SoundSet.Searchify(searchString)))
            {
                currentSet.Sort();
            }
            else
            {
                searchResults.Sort((Phrase phrase1, Phrase phrase2) => {
                    if (sortMode == SortMode.Alphabetic)
                    {
                        return(phrase1.name.ToUpper().CompareTo(phrase2.name.ToUpper()));
                    }
                    else if (sortMode == SortMode.MostPlayed)
                    {
                        return(phrase2.timesPlayed - phrase1.timesPlayed);
                    }
                    else if (sortMode == SortMode.SearchRelevance)
                    {
                        return(SoundSet.ComparePhrasesBySearchRelevance(phrase1.name.ToUpper(), phrase2.name.ToUpper(), SoundSet.Searchify(searchString)));
                    }
                    else
                    {
                        return(0);
                    }
                });
            }
        });
        brush = new Rect(0.0f, 0.0f, scrollArea.width - 24, lineHeight);
        System.Func <Rect, string, System.Action, bool> buttonFunc;
        if (mode == PlayMode.Spam)
        {
            buttonFunc = GUIF.RepeatButton;
        }
        else
        {
            buttonFunc = GUIF.Button;
        }
        if (!System.String.IsNullOrEmpty(SoundSet.Searchify(searchString)))
        {
            scrollPos = GUI.BeginScrollView(scrollArea, scrollPos, new Rect(0, 0, Screen.width * 0.9f - 24, lineHeight * 1.05f * searchResults.Count)); {
                brush.y = (int)(scrollPos.y / (brush.height * 1.05f)) * (brush.height * 1.05f);
                for (int i = (int)Mathf.Max(scrollPos.y / (brush.height * 1.05f), 0); scrollPos.y >= ((i - 1) * brush.height * 1.05f) - scrollArea.height && i < searchResults.Count; i++)
                {
                    Phrase phrase = searchResults[i];
                    str = phrase.name;
                    if (phrase.clips.Count > 1)
                    {
                        str += " (" + phrase.clips.Count + ")";
                    }
                    buttonFunc(brush, str, () => {
                        if (!scrolling)
                        {
                            switch (mode)
                            {
                            case PlayMode.Queue:
                                clipQueue.Enqueue(phrase.clips.Choose <AudioClip>());
                                break;

                            case PlayMode.AlwaysInstant:
                            case PlayMode.Spam:
                                PlaySound(phrase.clips.Choose <AudioClip>());
                                break;

                            case PlayMode.Override:
                                if (currentSound != null)
                                {
                                    currentSound.Stop();
                                }
                                PlaySound(phrase.clips.Choose <AudioClip>());
                                break;
                            }
                        }
                    });
                    brush = brush.Move(0.0f, 1.05f);
                }
            } GUI.EndScrollView();
        }
        else
        {
            scrollPos = GUI.BeginScrollView(scrollArea, scrollPos, new Rect(0, 0, Screen.width * 0.9f - 24, lineHeight * 1.05f * currentSet.phrases.Count)); {
                brush.y = (int)(scrollPos.y / (brush.height * 1.05f)) * (brush.height * 1.05f);
                for (int i = (int)Mathf.Max(scrollPos.y / (brush.height * 1.05f), 0); scrollPos.y >= ((i - 1) * brush.height * 1.05f) - scrollArea.height && i < currentSet.phrases.Count; i++)
                {
                    Phrase phrase = currentSet.phrases[i];
                    str = phrase.name;
                    if (phrase.clips.Count > 1)
                    {
                        str += " (" + phrase.clips.Count + ")";
                    }
                    buttonFunc(brush, str, () => {
                        switch (mode)
                        {
                        case PlayMode.Queue:
                            clipQueue.Enqueue(phrase.clips.Choose <AudioClip>());
                            break;

                        case PlayMode.AlwaysInstant:
                        case PlayMode.Spam:
                            PlaySound(phrase.clips.Choose <AudioClip>());
                            break;

                        case PlayMode.Override:
                            if (currentSound != null)
                            {
                                currentSound.Stop();
                            }
                            PlaySound(phrase.clips.Choose <AudioClip>());
                            break;
                        }
                        phrase.timesPlayed += 1;
                    });
                    brush = brush.Move(0.0f, 1.05f);
                }
            } GUI.EndScrollView();
        }
        buttonFunc(new Rect(scrollArea.x, Screen.height * 0.95f, scrollArea.width, lineHeight), "[Random]", () => {
            List <Phrase> set;
            if (System.String.IsNullOrEmpty(SoundSet.Searchify(searchString)))
            {
                set = currentSet.phrases;
            }
            else
            {
                set = searchResults;
            }
            if (set.Count > 0)
            {
                Phrase phrase = set.Choose <Phrase>();
                switch (mode)
                {
                case PlayMode.Queue:
                    clipQueue.Enqueue(phrase.clips.Choose <AudioClip>());
                    break;

                case PlayMode.AlwaysInstant:
                case PlayMode.Spam:
                    PlaySound(phrase.clips.Choose <AudioClip>());
                    break;

                case PlayMode.Override:
                    if (currentSound != null)
                    {
                        currentSound.Stop();
                    }
                    PlaySound(phrase.clips.Choose <AudioClip>());
                    break;
                }
                phrase.timesPlayed += 1;
            }
        });
    }