@Override
    public void run() {
        int frames = 0;
        long previousTime = System.nanoTime();
        double ns = 1000000000.0 / 60.0;
        double delta = 0;
        int updates = 0;
        long timer = System.currentTimeMillis();
        requestFocus(); //this is awesome!
        while (running) {
            long currentTime = System.nanoTime();
            delta += (currentTime - previousTime) / ns;
            previousTime = currentTime;
            if (delta >= 1) {
                tick();
                updates++;
                delta--;
            }
            frames++;
            if (menu) {
                if (add) {
                    renderAddress();
                } else {
                    renderMenu();
                }
            } else {
                if (pause) {
                    renderPause();
                } else {
                    if (win) {
                        renderWin();
                    } else if (loose) {
                        renderLoose();
                    } else {
                        render();
                    }
                }
            }
            while (System.currentTimeMillis() - timer > 1000) {
                timer += 1000;
                fps = frames;
                frames = 0;
                updates = 0;
            }
        }
    }