public void makeMagic() {
        prevKey = keyStates;
        keyStates = getKeyStates();
        moveSuccess = false;
        if (prevKey == keyStates) return;
        if ((keyStates & LEFT_PRESSED) != 0) {
            move(MV_LEFT);
        } else if ((keyStates & RIGHT_PRESSED) != 0) {
            move(MV_RIGHT);
        } else if ((keyStates & UP_PRESSED) != 0) {
            move(MV_UP);
        } else if ((keyStates & DOWN_PRESSED) != 0) {
            move(MV_DOWN);
        }

        emptyTiles.removeAllElements();
        for (int i = 0; i < 16; i++) {
            if (itemGrid[i].number == 0) {
                emptyTiles.addElement(itemGrid[i]);
            }
        }
        System.out.println("empty " + emptyTiles.size());
        if (!emptyTiles.isEmpty() && moveSuccess) {
            int rand = randomTile.randomInt(emptyTiles.size());
            itemGrid[((CellItem) emptyTiles.elementAt(rand)).positionInMatrix].number = initNumbers[randomTile.randomInt(2)];
        }

        drawItems();
        //need to paste new elements here
    }