 }
 
 /*---------------------------------------------------------------------------*/
-
-void initialize(void)
-{
-    px = WIDTH_S / 2;
-    py = HEIGHT_S / 2;
-    pc = 4;
-    pa = 0;
-    for (uint8_t idx = 0; idx < COOKIES; idx++) {
-        newCookie(idx);
+/*                             Control Functions                             */
+/*---------------------------------------------------------------------------*/
+
+static void initialize(void)
+{
+    arduboy.setAudioEnabled(true);
+    arduboy.drawBitmap(0, 24, imgTitle, IMG_TITLE_W, IMG_TITLE_H, WHITE);
+    arduboy.setCursor(40, 58);
+    arduboy.print(F("RYSK " APP_VERSION));
+    isPlaying = false;
+}
+
+static void update(void)
+{
+    if (isPlaying) {
+        updateGame();
+    } else {
+        randomSeed(rand() ^ micros()); // Shuffle random
+        if (arduboy.buttonDown(A_BUTTON | B_BUTTON)) {
+            initGame();
+        }
+    }
+}
+
+static void initGame(void)
+{
+    isPlaying = true;
+    playerX = WIDTH_S / 2;
+    playerY = HEIGHT_S / 2;
+    playerChr = 4;
+    playerAnim = 0;
+    for (COOKIE_T *pCookie = cookie; pCookie < cookie + COOKIES; pCookie++) {
+        newCookie(pCookie);
     }
     score = 0;
-    arduboy.setAudioEnabled(true);
-}
-
-void update(void)
-{
-    movePlayer();
-    for (uint8_t idx = 0; idx < COOKIES; idx++) {
-        if (cx[idx] + cvx[idx] < CK_SIZE_S || cx[idx] + cvx[idx] >= WIDTH_S - CK_SIZE_S) cvx[idx] = -cvx[idx];
-        if (cy[idx] + cvy[idx] < CK_SIZE_S || cy[idx] + cvy[idx] >= HEIGHT_S - CK_SIZE_S) cvy[idx] = -cvy[idx];
-        cx[idx] += cvx[idx];
-        cy[idx] += cvy[idx];
-        if (abs(px - cx[idx]) < HIT_DIFF_S && abs(py - cy[idx]) < HIT_DIFF_S) {
-            score++;
-            arduboy.playScore2(soundCapture, 0);
-            newCookie(idx);
-        }
-    }
-}
-
-void movePlayer(void)
+    gameTime = GAME_DURATION + FPS * 2;
+    ledLevel = 0;
+    arduboy.playScore2(soundStart, 0);
+}
+
+static void updateGame(void)
+{
+    gameTime--;
+    if (ledLevel > 0) ledLevel--;
+    if (gameTime <= GAME_DURATION && gameTime >= 0) {
+        movePlayer();
+        for (COOKIE_T *pCookie = cookie; pCookie < cookie + COOKIES; pCookie++) {
+            moveCookie(pCookie);
+            if (isInRange(pCookie, HIT_DIFF_S)) {
+                score++;
+                arduboy.playScore2(soundCapture, 2);
+                newCookie(pCookie);
+                uint8_t ledValue = pgm_read_byte(ledValues + score % 10);
+                ledRed = ledValue / 25;
+                ledGreen = ledValue / 5 % 5;
+                ledBlue = ledValue % 5;
+                ledLevel = LED_LEVEL_START;
+            }
+        }
+        if (gameTime == 0) {
+            arduboy.playScore2(soundOver, 1);
+        }
+    } else if (gameTime <= -FPS) {
+        isPlaying = false;
+    }
+}
+
+static void movePlayer(void)
 {
     /*  Move  */
     int8_t vx = 0, vy = 0;

#define FPS             60
#define APP_TITLE       "RYSK"
#define APP_CODE        "OBN-Y00"
#define APP_VERSION     "0.02"
#define APP_RELEASED    "NOVEMBER 2019"

#define COOKIES     8
#define ANIM_MAX    16

#define PL_SIZE     4
#define CK_SIZE     2
#define SCALE       64
#define WIDTH_S     (WIDTH * SCALE)
#define HEIGHT_S    (HEIGHT * SCALE)
#define PL_SIZE_S   (PL_SIZE * SCALE)
#define CK_SIZE_S   (CK_SIZE * SCALE)
#define HIT_DIFF_S  PL_SIZE_S
#define NEW_DIFF_S  (PL_SIZE_S * 4)

/*  Functions  */

void initialize(void);
void update(void);
void movePlayer(void);
void newCookie(uint8_t idx);
void draw(void);

/*  Variables  */

PROGMEM static const uint8_t imgPlayer[9][8] = { // 8x8 x9
    { 0xFE, 0xF2, 0xDE, 0xDE, 0xF2, 0xFE, 0xFE, 0xFE },

#endif

/*---------------------------------------------------------------------------*/
/*                               Entry Points                                */
/*---------------------------------------------------------------------------*/

void setup()
{
