// ------------------------------------
        // Profile change

        public static void Update()
        {
            if (Config.selectedProfile == -1 && profiles.Count > 0)
            {
                Config.selectedProfile = 0;
                Config.Save();
            }

            if ((Config.selectedProfile == -1 || !Config.enabled) && tempProfile == null)
            {
                keyboard.TurnOff();
                timer.Stop();
                timer.Enabled = false;
            }
            else if (tempProfile != null || (Config.selectedProfile != -1 && Config.enabled))
            {
                Profile p = tempProfile != null ? tempProfile : p = profiles[Config.selectedProfile];

                if (p.mode == Keyboard.Mode.AUDIO2 || p.mode == Keyboard.Mode.RAINBOW)
                {
                    timer.Enabled  = true;
                    timer.Interval = p.delay;
                    timer.Start();
                }
                else
                {
                    keyboard.TurnOff();
                    timer.Stop();
                    timer.Enabled = false;

                    keyboard.ApplyProfile(p);
                }
            }
        }