public void Update(InputHandler handler)
        {
            try
            {
                if (done)
                {
                    done = false;
                    return;
                }

                if (modeB)
                {

                    if(frames == 0)
                    {
                        ff = 0;
                        modeB = false;
                        return;
                    }
                    ff++;
                    ff %= frames;
                    left.LoadFrame(ff);
                    right.LoadFrame(ff);
                    lright.LoadFrame(ff);
                    lleft.LoadFrame(ff);
                }

                DragDropInterface.UpdateTextBox(textBox, handler);
                if (textBox.GetSelected()) return;
                if (fileMode != 0)
                {
                    if (fileMode == 1)
                    {
                        SaveFileSystem.SaveObjectToFile(new BodyAnimation(left, right, lleft, lright, frames), "Animations" + Path.DirectorySeparatorChar + textBox.GetText() + ".taj");
                        textBox.SetText("");

                    }
                    else if (fileMode == 2)
                    {
                        BodyAnimation a = SaveFileSystem.LoadObjectFromFile<BodyAnimation>("Animations" + Path.DirectorySeparatorChar + textBox.GetText() + ".taj", new GameLoader());
                        this.left = a.GetLeft();
                        this.lleft = a.GetLegLeft();
                        this.lright = a.GetLegRight();
                        this.right = a.GetRight();

                        this.frames = a.GetFrames();

                        this.ff = 0;
                        textBox.SetText("");
                    }
                    fileMode = 0;
                }

                left.Update(handler, testingRectangle.GetX(), testingRectangle.GetY() + 20);
                right.Update(handler, testingRectangle.GetX() + testingRectangle.GetWidth(), testingRectangle.GetY() + 20);
                lleft.Update(handler, testingRectangle.GetX() + 20, testingRectangle.GetY() + testingRectangle.GetHeight());
                lright.Update(handler, testingRectangle.GetX() - 20 + testingRectangle.GetWidth(), testingRectangle.GetY() + testingRectangle.GetHeight());

                if (!dragging && handler.CheckJustPressedKey(Keys.M))
                {
                    mode = !mode;
                }

                if (handler.CheckJustPressedKey(Keys.Escape) || handler.CheckJustPressedKey(Keys.A))
                {
                    done = true;
                }

                if (handler.CheckJustPressedKey(Keys.OemSemicolon))
                {
                    if (frames == 0) return;
                    modeB = !modeB;
                }

                if (handler.CheckJustPressedKey(Keys.D1))
                {
                    textBox.TellSelected(true);
                    fileMode = 1;

                }

                if (handler.CheckJustPressedKey(Keys.D2))
                {

                    textBox.TellSelected(true);
                    fileMode = 2;

                }

                if (handler.CheckJustPressedKey(Keys.S))
                {
                    left.SaveArm();
                    right.SaveArm();
                    lright.SaveArm();
                    lleft.SaveArm();
                    frames++;
                    ff++;
                }

                if (handler.CheckJustPressedKey(Keys.D))
                {
                    left.Clear(ff);
                    right.Clear(ff);
                    lright.Clear(ff);
                    lleft.Clear(ff);
                    frames = ff;

                }

                if (handler.CheckJustPressedKey(Keys.C))
                {
                    if (frames == 0) return;
                    if (left.Using())
                    {
                        left.SaveAt(ff, true);
                    }

                    if (right.Using())
                    {
                        right.SaveAt(ff, true);
                    }
                    if (lleft.Using())
                    {
                        lleft.SaveAt(ff, true);
                    }
                    if (lright.Using())
                    {
                        lright.SaveAt(ff, true);
                    }

                    ff++;

                    ff %= frames;
                    left.LoadFrame(ff);
                    right.LoadFrame(ff);
                    lright.LoadFrame(ff);
                    lleft.LoadFrame(ff);
                }

                if (handler.CheckJustPressedKey(Keys.V))
                {
                    if (frames == 0) return;

                    if (left.Using())
                    {
                        left.SaveAt(ff, false);
                    }

                    if (right.Using())
                    {
                        right.SaveAt(ff, false);
                    }
                    if (lleft.Using())
                    {
                        lleft.SaveAt(ff, false);
                    }
                    if (lright.Using())
                    {
                        lright.SaveAt(ff, false);
                    }

                    ff++;

                    ff %= frames;
                    left.LoadFrame(ff);
                    right.LoadFrame(ff);
                    lright.LoadFrame(ff);
                    lleft.LoadFrame(ff);
                }

                if (handler.CheckJustPressedKey(Keys.B))
                {
                    dragBody = !dragBody;
                }

                if (handler.CheckJustPressedKey(Keys.Z))
                {
                    squareOrCircle = !squareOrCircle;
                }

                if (handler.CheckJustPressedKey(Keys.OemPlus))
                {
                    ff++;
                    ff %= frames;
                    left.LoadFrame(ff);
                    right.LoadFrame(ff);
                    lright.LoadFrame(ff);
                    lleft.LoadFrame(ff);

                }

                if (handler.CheckJustPressedKey(Keys.OemMinus))
                {
                    ff--;
                    if (ff < 0) ff = 0;
                    left.LoadFrame(ff);
                    right.LoadFrame(ff);
                    lright.LoadFrame(ff);
                    lleft.LoadFrame(ff);
                }

                if (handler.CheckPressedKey(Keys.LeftShift) || handler.CheckPressedKey(Keys.RightShift))
                {
                    if (handler.CheckPressedKey(Keys.Down))
                    {
                        testingRectangle.ModifyHeight(SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Up))
                    {
                        testingRectangle.ModifyHeight(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Left))
                    {
                        testingRectangle.ModifyWidth(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Right))
                    {
                        testingRectangle.ModifyWidth(SPEED);
                    }
                }
                else
                {
                    if (handler.CheckPressedKey(Keys.Down))
                    {
                        testingRectangle.ModifyY(SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Up))
                    {
                        testingRectangle.ModifyY(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Left))
                    {
                        testingRectangle.ModifyX(-SPEED);
                    }

                    if (handler.CheckPressedKey(Keys.Right))
                    {
                        testingRectangle.ModifyX(SPEED);
                    }
                }

                #region Check if the mouse is in the body.
                if (dragBody)
                    if (handler.CheckMouseIn(testingRectangle))
                    {

                        if (handler.CheckLeftMousePressed())
                        {
                            if (!dragging && handler.LeftMouseDraggedBy().X == 0 && handler.LeftMouseDraggedBy().Y == 0)
                            {
                                this.originalPoint = testingRectangle.GetPoint();
                                if (mode) this.originalPoint = testingRectangle.GetSize();
                                dragging = true;
                            }

                        }
                        else
                        {
                            color = Color.Red;
                            dragging = false;
                        }

                    }
                    else
                    {
                        color = Color.DarkGray;
                    }

                if (dragging)
                {
                    color = Color.DarkRed;
                    Point fix = originalPoint + handler.LeftMouseDraggedBy();
                    if (mode)
                    {
                        testingRectangle.SetSize(ref fix);

                    }
                    else
                    {

                        testingRectangle.SetPoint(ref fix);
                    }
                }

                #endregion

                blink++;
            } catch (Exception ex)
            {
                Logger.WriteLine(ex.ToString());
                fileMode = 0;
            }
        }