diff --git a/apps/SOURCES b/apps/SOURCES
index 181c780..d99d608 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -95,12 +95,12 @@ gui/viewport.c
 
 gui/skin_engine/skin_backdrops.c
 gui/skin_engine/skin_buffer.c
-gui/skin_engine/wps_debug.c
 gui/skin_engine/skin_display.c
 #ifdef HAVE_LCD_BITMAP
 gui/skin_engine/skin_fonts.c
 #endif
 gui/skin_engine/skin_parser.c
+gui/skin_engine/skin_render.c
 gui/skin_engine/skin_tokens.c
 #ifdef HAVE_TOUCHSCREEN
 gui/skin_engine/skin_touchsupport.c
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index cadb2ab..0c5b797 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -363,17 +363,17 @@ const char *get_cuesheetid3_token(struct wps_token *token, struct mp3entry *id3,
     }
     switch (token->type)
     {
-        case WPS_TOKEN_METADATA_ARTIST:
+        case SKIN_TOKEN_METADATA_ARTIST:
             return *track->performer ? track->performer : NULL;
-        case WPS_TOKEN_METADATA_COMPOSER:
+        case SKIN_TOKEN_METADATA_COMPOSER:
             return *track->songwriter ? track->songwriter : NULL;
-        case WPS_TOKEN_METADATA_ALBUM:
+        case SKIN_TOKEN_METADATA_ALBUM:
             return *cue->title ? cue->title : NULL;
-        case WPS_TOKEN_METADATA_ALBUM_ARTIST:
+        case SKIN_TOKEN_METADATA_ALBUM_ARTIST:
             return *cue->performer ? cue->performer : NULL;
-        case WPS_TOKEN_METADATA_TRACK_TITLE:
+        case SKIN_TOKEN_METADATA_TRACK_TITLE:
             return *track->title ? track->title : NULL;
-        case WPS_TOKEN_METADATA_TRACK_NUMBER:
+        case SKIN_TOKEN_METADATA_TRACK_NUMBER:
             snprintf(buf, buf_size, "%d/%d",  
                      cue->curr_track_idx+offset_tracks+1, cue->track_count);
             return buf;
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 3d3a654..e92300c 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -86,7 +86,7 @@ bool skin_update(struct gui_wps *gwps, unsigned int update_type)
     gwps->sync_data->do_full_update |= cuesheet_update;
  
     retval = skin_redraw(gwps, gwps->sync_data->do_full_update ?
-                                        WPS_REFRESH_ALL : update_type);
+                                        SKIN_REFRESH_ALL : update_type);
     return retval;
 }
 
@@ -124,8 +124,7 @@ void skin_statusbar_changed(struct gui_wps *skin)
     }
 }
 
-static void draw_progressbar(struct gui_wps *gwps,
-                             struct progressbar *pb)
+void draw_progressbar(struct gui_wps *gwps, struct progressbar *pb)
 {
     struct screen *display = gwps->display;
     struct viewport *vp = pb->vp;
@@ -146,14 +145,14 @@ static void draw_progressbar(struct gui_wps *gwps,
         y = (-y -1)*line_height + (0 > center ? 0 : center);
     }
 
-    if (pb->type == WPS_TOKEN_VOLUMEBAR)
+    if (pb->type == SKIN_TOKEN_VOLUMEBAR)
     {
         int minvol = sound_min(SOUND_VOLUME);
         int maxvol = sound_max(SOUND_VOLUME);
         length = maxvol-minvol;
         elapsed = global_settings.volume-minvol;
     }
-    else if (pb->type == WPS_TOKEN_BATTERY_PERCENTBAR)
+    else if (pb->type == SKIN_TOKEN_BATTERY_PERCENTBAR)
     {
         length = 100;
         elapsed = battery_level();
@@ -185,7 +184,7 @@ static void draw_progressbar(struct gui_wps *gwps,
         gui_scrollbar_draw(display, pb->x, y, pb->width, height,
                            length, 0, elapsed, HORIZONTAL);
 
-    if (pb->type == WPS_TOKEN_PROGRESSBAR)
+    if (pb->type == SKIN_TOKEN_PROGRESSBAR)
     {
         if (id3 && id3->length)
         {
@@ -208,7 +207,7 @@ static void draw_progressbar(struct gui_wps *gwps,
     }
 }
 
-static void draw_playlist_viewer_list(struct gui_wps *gwps,
+void draw_playlist_viewer_list(struct gui_wps *gwps,
                                       struct playlistviewer *viewer)
 {
     struct wps_state *state = gwps->state;
@@ -218,7 +217,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
     int start_item;
     int i;
     struct wps_token token;
-    int x, length, alignment = WPS_TOKEN_ALIGN_LEFT;
+    int x, length, alignment = SKIN_TOKEN_ALIGN_LEFT;
     
     struct mp3entry *pid3;
     char buf[MAX_PATH*2], tempbuf[MAX_PATH];
@@ -305,27 +304,27 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
             
             switch (viewer->lines[line].tokens[j])
             {
-                case WPS_TOKEN_ALIGN_CENTER:
-                case WPS_TOKEN_ALIGN_LEFT:
-                case WPS_TOKEN_ALIGN_LEFT_RTL:
-                case WPS_TOKEN_ALIGN_RIGHT:
-                case WPS_TOKEN_ALIGN_RIGHT_RTL:
+                case SKIN_TOKEN_ALIGN_CENTER:
+                case SKIN_TOKEN_ALIGN_LEFT:
+                case SKIN_TOKEN_ALIGN_LEFT_RTL:
+                case SKIN_TOKEN_ALIGN_RIGHT:
+                case SKIN_TOKEN_ALIGN_RIGHT_RTL:
                     alignment = viewer->lines[line].tokens[j];
                     tempbuf[0] = '\0';
                     break;
-                case WPS_TOKEN_STRING:
-                case WPS_TOKEN_CHARACTER:
+                case SKIN_TOKEN_STRING:
+                case SKIN_TOKEN_CHARACTER:
                     snprintf(tempbuf, sizeof(tempbuf), "%s",
                              viewer->lines[line].strings[cur_string]);
                     cur_string++;
                     break;
-                case WPS_TOKEN_PLAYLIST_POSITION:
+                case SKIN_TOKEN_PLAYLIST_POSITION:
                     snprintf(tempbuf, sizeof(tempbuf), "%d", i);
                     break;
-                case WPS_TOKEN_FILE_NAME:
+                case SKIN_TOKEN_FILE_NAME:
                     get_dir(tempbuf, sizeof(tempbuf), filename, 0);
                     break;
-                case WPS_TOKEN_FILE_PATH:
+                case SKIN_TOKEN_FILE_PATH:
                     snprintf(tempbuf, sizeof(tempbuf), "%s", filename);
                     break;
                 default:
@@ -353,25 +352,25 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
             {
                 switch (alignment)
                 {
-                    case WPS_TOKEN_ALIGN_CENTER:
+                    case SKIN_TOKEN_ALIGN_CENTER:
                         x = (vpwidth-length)/2;
                         break;
-                    case WPS_TOKEN_ALIGN_LEFT_RTL:
+                    case SKIN_TOKEN_ALIGN_LEFT_RTL:
                         if (lang_is_rtl() && VP_IS_RTL(viewer->vp))
                         {
                             x = vpwidth - length;
                             break;
                         }
-                    case WPS_TOKEN_ALIGN_LEFT:
+                    case SKIN_TOKEN_ALIGN_LEFT:
                         x = 0;
                         break;
-                    case WPS_TOKEN_ALIGN_RIGHT_RTL:
+                    case SKIN_TOKEN_ALIGN_RIGHT_RTL:
                         if (lang_is_rtl() && VP_IS_RTL(viewer->vp))
                         {
                             x = 0;
                             break;
                         }
-                    case WPS_TOKEN_ALIGN_RIGHT:
+                    case SKIN_TOKEN_ALIGN_RIGHT:
                         x = vpwidth - length;
                         break;
                     default:
@@ -386,7 +385,7 @@ static void draw_playlist_viewer_list(struct gui_wps *gwps,
 
 
 /* clears the area where the image was shown */
-static void clear_image_pos(struct gui_wps *gwps, struct gui_img *img)
+void clear_image_pos(struct gui_wps *gwps, struct gui_img *img)
 {
     if(!gwps)
         return;
@@ -395,7 +394,7 @@ static void clear_image_pos(struct gui_wps *gwps, struct gui_img *img)
     gwps->display->set_drawmode(DRMODE_SOLID);
 }
 
-static void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subimage)
+void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subimage)
 {
     struct screen *display = gwps->display;
     if(img->always_display)
@@ -422,53 +421,6 @@ static void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subima
     }
 #endif
 }
-
-static void wps_display_images(struct gui_wps *gwps, struct viewport* vp)
-{
-    if(!gwps || !gwps->data || !gwps->display)
-        return;
-
-    struct wps_data *data = gwps->data;
-    struct screen *display = gwps->display;
-    struct skin_token_list *list = data->images;
-
-    while (list)
-    {
-        struct gui_img *img = (struct gui_img*)list->token->value.data;
-        if (img->loaded)
-        {
-            if (img->display >= 0)
-            {
-                wps_draw_image(gwps, img, img->display);
-            }
-            else if (img->always_display && img->vp == vp)
-            {
-                wps_draw_image(gwps, img, 0);
-            }
-        }
-        list = list->next;
-    }
-#ifdef HAVE_ALBUMART
-    /* now draw the AA */
-    if (data->albumart && data->albumart->vp == vp
-        && data->albumart->draw)
-    {
-        int handle = playback_current_aa_hid(data->playback_aa_slot);
-#if CONFIG_TUNER
-        if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF))
-        {
-            struct dim dim = {data->albumart->width, data->albumart->height};
-            handle = radio_get_art_hid(&dim);
-        }
-#endif
-        draw_album_art(gwps, handle, false);
-        data->albumart->draw = false;
-    }
-#endif
-
-    display->set_drawmode(DRMODE_SOLID);
-}
-
 #else /* HAVE_LCD_CHARCELL */
 
 static bool draw_player_progress(struct gui_wps *gwps)
@@ -613,44 +565,28 @@ static void draw_player_fullbar(struct gui_wps *gwps, char* buf, int buf_size)
 
 #endif /* HAVE_LCD_CHARCELL */
 
-/* Return the index to the end token for the conditional token at index.
-   The conditional token can be either a start token or a separator
-   (i.e. option) token.
-*/
-static int find_conditional_end(struct wps_data *data, int index)
-{
-    int ret = index;
-    while (data->tokens[ret].type != WPS_TOKEN_CONDITIONAL_END)
-        ret = data->tokens[ret].value.i;
-
-    /* ret now is the index to the end token for the conditional. */
-    return ret;
-}
-
 /* Evaluate the conditional that is at *token_index and return whether a skip
    has ocurred. *token_index is updated with the new position.
 */
-static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
+int evaluate_conditional(struct gui_wps *gwps, struct conditional *conditional, int num_options)
 {
     if (!gwps)
         return false;
 
     struct wps_data *data = gwps->data;
 
-    int i, cond_end;
-    int cond_index = *token_index;
     char result[128];
     const char *value;
-    unsigned char num_options = data->tokens[cond_index].value.i & 0xFF;
-    unsigned char prev_val = (data->tokens[cond_index].value.i & 0xFF00) >> 8;
+    int prev_val = conditional->last_value;
 
-    /* treat ?xx<true> constructs as if they had 2 options. */
+    /* treat ?xx<true> constructs as if they had 2 options. 
+     * (i.e ?xx<true|false>) */
     if (num_options < 2)
         num_options = 2;
 
     int intval = num_options;
     /* get_token_value needs to know the number of options in the enum */
-    value = get_token_value(gwps, &data->tokens[cond_index + 1],
+    value = get_token_value(gwps, conditional->token,
                             result, sizeof(result), &intval);
 
     /* intval is now the number of the enum option we want to read,
@@ -660,333 +596,17 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
     else if (intval > num_options || intval < 1)
         intval = num_options;
 
-    data->tokens[cond_index].value.i = (intval << 8) + num_options;
-
-    /* skip to the appropriate enum case */
-    int next = cond_index + 2;
-    for (i = 1; i < intval; i++)
-    {
-        next = data->tokens[next].value.i;
-    }
-    *token_index = next;
-
-    if (prev_val == intval)
-    {
-        /* Same conditional case as previously. Return without clearing the
-           pictures */
-        return false;
-    }
-
-    cond_end = find_conditional_end(data, cond_index + 2);
-    for (i = cond_index + 3; i < cond_end; i++)
-    {
-#ifdef HAVE_LCD_BITMAP
-        /* clear all pictures in the conditional and nested ones */
-        if (data->tokens[i].type == WPS_TOKEN_IMAGE_PRELOAD_DISPLAY)
-            clear_image_pos(gwps, find_image(data->tokens[i].value.i&0xFF, data));
-        else if (data->tokens[i].type == WPS_TOKEN_VOLUMEBAR   ||
-                 data->tokens[i].type == WPS_TOKEN_PROGRESSBAR ||
-                 data->tokens[i].type == WPS_TOKEN_BATTERY_PERCENTBAR )
-        {
-            struct progressbar *bar = (struct progressbar*)data->tokens[i].value.data;
-            bar->draw = false;
-        }
-        else if (data->tokens[i].type == WPS_TOKEN_PEAKMETER)
-        {
-            data->peak_meter_enabled = false;
-        }
-#endif
-#ifdef HAVE_ALBUMART
-        if (data->albumart && data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY)
-        {
-            draw_album_art(gwps,
-                    playback_current_aa_hid(data->playback_aa_slot), true);
-            data->albumart->draw = false;
-        }
-#endif
-    }
-
-    return true;
-}
-
-
-/* Read a (sub)line to the given alignment format buffer.
-   linebuf is the buffer where the data is actually stored.
-   align is the alignment format that'll be used to display the text.
-   The return value indicates whether the line needs to be updated.
-*/
-static bool get_line(struct gui_wps *gwps,
-                     struct skin_subline *subline,
-                     struct align_pos *align,
-                     char *linebuf,
-                     int linebuf_size,
-                     unsigned refresh_mode)
-{
-    struct wps_data *data = gwps->data;
-
-    char temp_buf[128];
-    char *buf = linebuf;  /* will always point to the writing position */
-    char *linebuf_end = linebuf + linebuf_size - 1;
-    bool update = false;
-    int i;
-    (void)refresh_mode; /* silence warning on charcell */
-
-    /* alignment-related variables */
-    int cur_align;
-    char* cur_align_start;
-    cur_align_start = buf;
-    cur_align = WPS_ALIGN_LEFT;
-    align->left = NULL;
-    align->center = NULL;
-    align->right = NULL;
-    /* Process all tokens of the desired subline */
-    for (i = subline->first_token_idx;
-         i <= subline->last_token_idx; i++)
-    {
-        switch(data->tokens[i].type)
-        {
-            case WPS_TOKEN_CONDITIONAL:
-                /* place ourselves in the right conditional case */
-                update |= evaluate_conditional(gwps, &i);
-                break;
-
-            case WPS_TOKEN_CONDITIONAL_OPTION:
-                /* we've finished in the curent conditional case,
-                    skip to the end of the conditional structure */
-                i = find_conditional_end(data, i);
-                break;
-#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
-            case WPS_TOKEN_VIEWPORT_FGCOLOUR:
-            {
-                struct viewport_colour *col = data->tokens[i].value.data;
-                col->vp->fg_pattern = col->colour;
-            }
-            break;
-            case WPS_TOKEN_VIEWPORT_BGCOLOUR:
-            {
-                struct viewport_colour *col = data->tokens[i].value.data;
-                col->vp->bg_pattern = col->colour;
-            }
-            break;
-#endif
-#ifdef HAVE_LCD_BITMAP
-            case WPS_TOKEN_PEAKMETER:
-                data->peak_meter_enabled = true;
-                break;
-            case WPS_TOKEN_VOLUMEBAR:
-            case WPS_TOKEN_BATTERY_PERCENTBAR:
-            case WPS_TOKEN_PROGRESSBAR:
-            {
-                struct progressbar *bar = (struct progressbar*)data->tokens[i].value.data;
-                bar->draw = true;
-            }
-            break;
-            case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY:
-            {
-                char n = data->tokens[i].value.i & 0xFF;
-                int subimage = data->tokens[i].value.i >> 8;
-                struct gui_img *img = find_image(n, data);
-
-                if (img && img->loaded)
-                    img->display = subimage;
-                break;
-            }
-            case WPS_TOKEN_DRAW_INBUILTBAR:
-                gui_statusbar_draw(&(statusbars.statusbars[gwps->display->screen_type]),
-                                   refresh_mode == WPS_REFRESH_ALL,
-                                   data->tokens[i].value.data);
-                break;
-#endif
-
-            case WPS_TOKEN_ALIGN_LEFT:
-            case WPS_TOKEN_ALIGN_LEFT_RTL:
-            case WPS_TOKEN_ALIGN_CENTER:
-            case WPS_TOKEN_ALIGN_RIGHT:
-            case WPS_TOKEN_ALIGN_RIGHT_RTL:
-                /* remember where the current aligned text started */
-                switch (cur_align)
-                {
-                    case WPS_ALIGN_LEFT:
-                        align->left = cur_align_start;
-                        break;
-
-                    case WPS_ALIGN_CENTER:
-                        align->center = cur_align_start;
-                        break;
-
-                    case WPS_ALIGN_RIGHT:
-                        align->right = cur_align_start;
-                        break;
-                }
-                /* start a new alignment */
-                switch (data->tokens[i].type)
-                {
-                    case WPS_TOKEN_ALIGN_LEFT:
-                        cur_align = WPS_ALIGN_LEFT;
-                        break;
-                    case WPS_TOKEN_ALIGN_LEFT_RTL:
-                        cur_align = lang_is_rtl() ? WPS_ALIGN_RIGHT :
-                            WPS_ALIGN_LEFT;
-                        break;
-                    case WPS_TOKEN_ALIGN_CENTER:
-                        cur_align = WPS_ALIGN_CENTER;
-                        break;
-                    case WPS_TOKEN_ALIGN_RIGHT:
-                        cur_align = WPS_ALIGN_RIGHT;
-                        break;
-                    case WPS_TOKEN_ALIGN_RIGHT_RTL:
-                        cur_align = lang_is_rtl() ? WPS_ALIGN_LEFT :
-                            WPS_ALIGN_RIGHT;
-                        break;
-                    default:
-                        break;
-                }
-                *buf++ = 0;
-                cur_align_start = buf;
-                break;
-            case WPS_VIEWPORT_ENABLE:
-            {
-                char label = data->tokens[i].value.i;
-                char temp = VP_DRAW_HIDEABLE;
-                /* viewports are allowed to share id's so find and enable
-                 * all of them */
-                struct skin_token_list *list = data->viewports;
-                while (list)
-                {
-                    struct skin_viewport *vp =
-                                (struct skin_viewport *)list->token->value.data;
-                    if (vp->label == label)
-                    {
-                        if (vp->hidden_flags&VP_DRAW_WASHIDDEN)
-                            temp |= VP_DRAW_WASHIDDEN;
-                        vp->hidden_flags = temp;
-                    }
-                    list = list->next;
-                }
-            }
-                break;
-#ifdef HAVE_LCD_BITMAP
-            case WPS_TOKEN_UIVIEWPORT_ENABLE:
-                    sb_set_info_vp(gwps->display->screen_type, 
-                                   data->tokens[i].value.i|VP_INFO_LABEL);
-                break;
-            case WPS_VIEWPORT_CUSTOMLIST:
-                draw_playlist_viewer_list(gwps, data->tokens[i].value.data);
-                break;
-#endif
-            default:
-            {
-                /* get the value of the tag and copy it to the buffer */
-                const char *value = get_token_value(gwps, &data->tokens[i],
-                                              temp_buf, sizeof(temp_buf), NULL);
-                if (value)
-                {
-                    update = true;
-                    while (*value && (buf < linebuf_end))
-                        *buf++ = *value++;
-                }
-                break;
-            }
-        }
-    }
-
-    /* close the current alignment */
-    switch (cur_align)
-    {
-        case WPS_ALIGN_LEFT:
-            align->left = cur_align_start;
-            break;
-
-        case WPS_ALIGN_CENTER:
-            align->center = cur_align_start;
-            break;
-
-        case WPS_ALIGN_RIGHT:
-            align->right = cur_align_start;
-            break;
-    }
-
-    return update;
-}
-static void get_subline_timeout(struct gui_wps *gwps, struct skin_subline *subline)
-{
-    struct wps_data *data = gwps->data;
-    int i;
-    subline->time_mult = DEFAULT_SUBLINE_TIME_MULTIPLIER;
-
-    for (i = subline->first_token_idx;
-         i <= subline->last_token_idx; i++)
-    {
-        switch(data->tokens[i].type)
-        {
-            case WPS_TOKEN_CONDITIONAL:
-                /* place ourselves in the right conditional case */
-                evaluate_conditional(gwps, &i);
-                break;
-
-            case WPS_TOKEN_CONDITIONAL_OPTION:
-                /* we've finished in the curent conditional case,
-                    skip to the end of the conditional structure */
-                i = find_conditional_end(data, i);
-                break;
-
-            case WPS_TOKEN_SUBLINE_TIMEOUT:
-                subline->time_mult = data->tokens[i].value.i;
-                break;
-
-            default:
-                break;
-        }
-    }
+    conditional->last_value = intval -1;
+    return intval -1;
 }
 
-/* Calculates which subline should be displayed for the specified line
-   Returns true iff the subline must be refreshed */
-static bool update_curr_subline(struct gui_wps *gwps, struct skin_line *line)
-{
-    /* shortcut this whole thing if we need to reset the line completly */
-    if (line->curr_subline == NULL)
-    {
-        line->subline_expire_time = current_tick;
-        line->curr_subline = &line->sublines;
-        if (!line->curr_subline->next)
-        {
-            line->subline_expire_time += 100*HZ;
-        }
-        else
-        {
-            get_subline_timeout(gwps, line->curr_subline);
-            line->subline_expire_time += TIMEOUT_UNIT*line->curr_subline->time_mult;
-        }
-        return true;
-    }
-    /* if time to advance to next sub-line  */
-    if (TIME_AFTER(current_tick, line->subline_expire_time - 1))
-    {
-        /* if there is only one subline, there is no need to search for a new one */
-        if (&line->sublines == line->curr_subline &&
-             line->curr_subline->next == NULL)
-        {
-            line->subline_expire_time += 100 * HZ;
-            return false;
-        }
-        if (line->curr_subline->next)
-            line->curr_subline = line->curr_subline->next;
-        else
-            line->curr_subline = &line->sublines;
-        get_subline_timeout(gwps, line->curr_subline);
-        line->subline_expire_time = current_tick + TIMEOUT_UNIT*line->curr_subline->time_mult;
-        return true;
-    }
-    return false;
-}
 
 /* Display a line appropriately according to its alignment format.
    format_align contains the text, separated between left, center and right.
    line is the index of the line on the screen.
    scroll indicates whether the line is a scrolling one or not.
 */
-static void write_line(struct screen *display,
+void write_line(struct screen *display,
                        struct align_pos *format_align,
                        int line,
                        bool scroll)
@@ -1145,6 +765,7 @@ static void write_line(struct screen *display,
 
 static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
 {
+#if 0
     struct wps_data *data = gwps->data;
     struct screen *display = gwps->display;
 
@@ -1176,6 +797,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
             display->clear_viewport();
         }
 
+        /* FIXME: set each subline to the beginingg
         for (viewport_list = data->viewports;
              viewport_list; viewport_list = viewport_list->next)
         {
@@ -1186,6 +808,7 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
                 line->curr_subline = NULL;
             }
         }
+        * */
     }
 
 #ifdef HAVE_LCD_CHARCELLS
@@ -1379,7 +1002,8 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
     display->set_viewport(NULL);
 
     display->update();
-
+#endif
+    skin_render(gwps, refresh_mode);
     return true;
 }
 
@@ -1434,7 +1058,7 @@ int skin_wait_for_action(struct gui_wps *gwps, int context, int timeout)
                 FOR_NB_SCREENS(i)
                 {
                     if(gwps[i].data->peak_meter_enabled)
-                        skin_update(&gwps[i], WPS_REFRESH_PEAK_METER);
+                        skin_update(&gwps[i], SKIN_REFRESH_PEAK_METER);
                     next_refresh += HZ / PEAK_METER_FPS;
                 }
             }
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h
index 69991ab..c65732b 100644
--- a/apps/gui/skin_engine/skin_engine.h
+++ b/apps/gui/skin_engine/skin_engine.h
@@ -23,6 +23,7 @@
 #ifndef _SKIN_ENGINE_H
 #define _SKIN_ENGINE_H
 
+#include "tag_table.h"
 #include "skin_buffer.h"
 
 #include "wps_internals.h" /* TODO: remove this line.. shoudlnt be needed */
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index cca2c95..523677d 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -28,6 +28,10 @@
 #include "plugin.h"
 #include "viewport.h"
 
+#include "skin_parser.h"
+#include "skin_buffer.h"
+#include "tag_table.h"
+
 #ifdef __PCTOOL__
 #ifdef WPSEDITOR
 #include "proxy.h"
@@ -71,30 +75,20 @@
 
 #define WPS_ERROR_INVALID_PARAM         -1
 
-/* which screen are we parsing for? */
-static enum screen_type curr_screen;
-
-/* level of current conditional.
-   -1 means we're not in a conditional. */
-static int level = -1;
-
-/* index of the last WPS_TOKEN_CONDITIONAL_OPTION
-    or WPS_TOKEN_CONDITIONAL_START in current level */
-static int lastcond[WPS_MAX_COND_LEVEL];
 
-/* index of the WPS_TOKEN_CONDITIONAL in current level */
-static int condindex[WPS_MAX_COND_LEVEL];
+static bool isdefault(struct skin_tag_parameter *param)
+{
+    return param->type == DEFAULT;
+}
 
-/* number of condtional options in current level */
-static int numoptions[WPS_MAX_COND_LEVEL];
 
-/* line number, debug only */
-static int line_number;
+/* which screen are we parsing for? */
+static enum screen_type curr_screen;
 
 /* the current viewport */
 static struct skin_viewport *curr_vp;
-/* the current line, linked to the above viewport */
-static struct skin_line *curr_line;
+
+struct line *curr_line;
 
 static int follow_lang_direction = 0;
 
@@ -118,12 +112,12 @@ typedef int (*wps_tag_parse_func)(const char *wps_bufptr,
                 struct wps_token *token, struct wps_data *wps_data);
 
 struct wps_tag {
-    enum wps_token_type type;
+    enum skin_token_type type;
     const char name[3];
     unsigned char refresh_type;
     const wps_tag_parse_func parse_func;
 };
-static int skip_end_of_line(const char *wps_bufptr);
+
 /* prototypes of all special parse functions : */
 static int parse_timeout(const char *wps_bufptr,
         struct wps_token *token, struct wps_data *wps_data);
@@ -152,8 +146,6 @@ static int parse_viewport_display(const char *wps_bufptr,
         struct wps_token *token, struct wps_data *wps_data);
 static int parse_playlistview(const char *wps_bufptr,
         struct wps_token *token, struct wps_data *wps_data);
-static int parse_viewport(const char *wps_bufptr,
-        struct wps_token *token, struct wps_data *wps_data);
 static int parse_statusbar_enable(const char *wps_bufptr,
         struct wps_token *token, struct wps_data *wps_data);
 static int parse_statusbar_disable(const char *wps_bufptr,
@@ -176,8 +168,6 @@ static int parse_image_special(const char *wps_bufptr,
 #ifdef HAVE_ALBUMART
 static int parse_albumart_load(const char *wps_bufptr,
         struct wps_token *token, struct wps_data *wps_data);
-static int parse_albumart_display(const char *wps_bufptr,
-        struct wps_token *token, struct wps_data *wps_data);
 #endif /* HAVE_ALBUMART */
 #ifdef HAVE_TOUCHSCREEN
 static int parse_touchregion(const char *wps_bufptr,
@@ -187,7 +177,7 @@ static int fulline_tag_not_supported(const char *wps_bufptr,
         struct wps_token *token, struct wps_data *wps_data)
 {
     (void)token; (void)wps_data;
-    return skip_end_of_line(wps_bufptr);
+    return 0;
 }
 #define parse_touchregion fulline_tag_not_supported
 #endif
@@ -201,243 +191,67 @@ static int fulline_tag_not_supported(const char *wps_bufptr,
    (e.g. "xl" and "xd" before "x"). It needs to end with the unknown token. */
 static const struct wps_tag all_tags[] = {
 
-    { WPS_TOKEN_ALIGN_CENTER,             "ac",  0,                   NULL },
-    { WPS_TOKEN_ALIGN_LEFT,               "al",  0,                   NULL },
-    { WPS_TOKEN_ALIGN_LEFT_RTL,           "aL",  0,                   NULL },
-    { WPS_TOKEN_ALIGN_RIGHT,              "ar",  0,                   NULL },
-    { WPS_TOKEN_ALIGN_RIGHT_RTL,          "aR",  0,                   NULL },
-    { WPS_NO_TOKEN,                       "ax",  0,   parse_languagedirection },
-
-    { WPS_TOKEN_BATTERY_PERCENT,          "bl",  WPS_REFRESH_DYNAMIC, parse_progressbar },
-    { WPS_TOKEN_BATTERY_VOLTS,            "bv",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_BATTERY_TIME,             "bt",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_BATTERY_SLEEPTIME,        "bs",  WPS_REFRESH_DYNAMIC, NULL },
-#if CONFIG_CHARGING >= CHARGING_MONITOR
-    { WPS_TOKEN_BATTERY_CHARGING,         "bc",  WPS_REFRESH_DYNAMIC, NULL },
-#endif
-#if CONFIG_CHARGING
-    { WPS_TOKEN_BATTERY_CHARGER_CONNECTED,"bp",  WPS_REFRESH_DYNAMIC, NULL },
-#endif
-#ifdef HAVE_USB_POWER
-    { WPS_TOKEN_USB_POWERED,              "bu",  WPS_REFRESH_DYNAMIC, NULL },
-#endif
+    { SKIN_TOKEN_ALIGN_LANGDIRECTION,   "ax",  0,   parse_languagedirection },
 
-    { WPS_TOKEN_RTC_PRESENT     ,             "cc", WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_RTC_DAY_OF_MONTH,             "cd", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED,"ce", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_12HOUR_CFG,               "cf", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED,      "cH", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_HOUR_24,                  "ck", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED,      "cI", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_HOUR_12,                  "cl", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_MONTH,                    "cm", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_MINUTE,                   "cM", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_SECOND,                   "cS", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_YEAR_2_DIGITS,            "cy", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_YEAR_4_DIGITS,            "cY", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_AM_PM_UPPER,              "cP", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_AM_PM_LOWER,              "cp", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_WEEKDAY_NAME,             "ca", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_MONTH_NAME,               "cb", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON,    "cu", WPS_RTC_REFRESH, NULL },
-    { WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN,    "cw", WPS_RTC_REFRESH, NULL },
-
-    /* current file */
-    { WPS_TOKEN_FILE_BITRATE,             "fb",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_FILE_CODEC,               "fc",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_FILE_FREQUENCY,           "ff",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_FILE_FREQUENCY_KHZ,       "fk",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_FILE_NAME_WITH_EXTENSION, "fm",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_FILE_NAME,                "fn",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_FILE_PATH,                "fp",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_FILE_SIZE,                "fs",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_FILE_VBR,                 "fv",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_FILE_DIRECTORY,           "d",   WPS_REFRESH_STATIC,
-                                                           parse_dir_level },
-
-    /* next file */
-    { WPS_TOKEN_FILE_BITRATE,             "Fb",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_FILE_CODEC,               "Fc",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_FILE_FREQUENCY,           "Ff",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_FILE_FREQUENCY_KHZ,       "Fk",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_FILE_NAME_WITH_EXTENSION, "Fm",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_FILE_NAME,                "Fn",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_FILE_PATH,                "Fp",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_FILE_SIZE,                "Fs",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_FILE_VBR,                 "Fv",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_FILE_DIRECTORY,           "D",   WPS_REFRESH_STATIC,
-                                                           parse_dir_level },
-
-    /* current metadata */
-    { WPS_TOKEN_METADATA_ARTIST,          "ia",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_COMPOSER,        "ic",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_ALBUM,           "id",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_ALBUM_ARTIST,    "iA",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_GROUPING,        "iG",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_GENRE,           "ig",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_DISC_NUMBER,     "ik",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_TRACK_NUMBER,    "in",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_TRACK_TITLE,     "it",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_VERSION,         "iv",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_YEAR,            "iy",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_METADATA_COMMENT,         "iC",  WPS_REFRESH_STATIC,  NULL },
-
-    /* next metadata */
-    { WPS_TOKEN_METADATA_ARTIST,          "Ia",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_COMPOSER,        "Ic",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_ALBUM,           "Id",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_ALBUM_ARTIST,    "IA",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_GROUPING,        "IG",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_GENRE,           "Ig",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_DISC_NUMBER,     "Ik",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_TRACK_NUMBER,    "In",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_TRACK_TITLE,     "It",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_VERSION,         "Iv",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_YEAR,            "Iy",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_METADATA_COMMENT,         "IC",  WPS_REFRESH_STATIC, NULL },
-
-#if (CONFIG_CODEC != MAS3507D)
-    { WPS_TOKEN_SOUND_PITCH,              "Sp",  WPS_REFRESH_DYNAMIC, NULL },
-#endif
-#if (CONFIG_CODEC == SWCODEC)
-    { WPS_TOKEN_SOUND_SPEED,              "Ss",  WPS_REFRESH_DYNAMIC, NULL },
-#endif
-#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
-    { WPS_TOKEN_VLED_HDD,                 "lh",  WPS_REFRESH_DYNAMIC, NULL },
-#endif
+    { SKIN_TOKEN_BATTERY_PERCENT,          "bl",  0, parse_progressbar },
+    { SKIN_TOKEN_FILE_DIRECTORY,           "d",   0, parse_dir_level },
+    { SKIN_TOKEN_FILE_DIRECTORY,           "D",   0, parse_dir_level },
 
-    { WPS_TOKEN_MAIN_HOLD,                "mh",  WPS_REFRESH_DYNAMIC, NULL },
+    { SKIN_TOKEN_BUTTON_VOLUME,            "mv",  0, parse_timeout },
 
-#ifdef HAS_REMOTE_BUTTON_HOLD
-    { WPS_TOKEN_REMOTE_HOLD,              "mr",  WPS_REFRESH_DYNAMIC, NULL },
-#else
-    { WPS_TOKEN_UNKNOWN,                  "mr",  0,                   NULL },
+#ifndef HAVE_LCD_BITMAP
+    { SKIN_TOKEN_PLAYER_PROGRESSBAR,       "pf", 0 parse_progressbar },
 #endif
+    { SKIN_TOKEN_PROGRESSBAR,              "pb",  0, parse_progressbar },
 
-    { WPS_TOKEN_REPEAT_MODE,              "mm",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_PLAYBACK_STATUS,          "mp",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_BUTTON_VOLUME,            "mv",  WPS_REFRESH_DYNAMIC,
-                                                             parse_timeout },
+    { SKIN_TOKEN_VOLUME,                   "pv",  0 ,parse_progressbar },
 
-#ifdef HAVE_LCD_BITMAP
-    { WPS_TOKEN_PEAKMETER,                "pm", WPS_REFRESH_PEAK_METER, NULL },
-#else
-    { WPS_TOKEN_PLAYER_PROGRESSBAR,       "pf",
-      WPS_REFRESH_DYNAMIC | WPS_REFRESH_PLAYER_PROGRESS, parse_progressbar },
-#endif
-    { WPS_TOKEN_PROGRESSBAR,              "pb",  WPS_REFRESH_PLAYER_PROGRESS,
-                                                         parse_progressbar },
-
-    { WPS_TOKEN_VOLUME,                   "pv",  WPS_REFRESH_DYNAMIC, 
-                                                         parse_progressbar },
-
-    { WPS_TOKEN_TRACK_ELAPSED_PERCENT,    "px",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_TRACK_TIME_ELAPSED,       "pc",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_TRACK_TIME_REMAINING,     "pr",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_TRACK_LENGTH,             "pt",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_TRACK_STARTING,           "pS",  WPS_REFRESH_DYNAMIC, parse_timeout },
-    { WPS_TOKEN_TRACK_ENDING,             "pE",  WPS_REFRESH_DYNAMIC, parse_timeout },
-
-    { WPS_TOKEN_PLAYLIST_POSITION,        "pp",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_PLAYLIST_ENTRIES,         "pe",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_PLAYLIST_NAME,            "pn",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_PLAYLIST_SHUFFLE,         "ps",  WPS_REFRESH_DYNAMIC, NULL },
-
-#ifdef HAVE_TAGCACHE
-    { WPS_TOKEN_DATABASE_PLAYCOUNT,       "rp",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_DATABASE_RATING,          "rr",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_DATABASE_AUTOSCORE,       "ra",  WPS_REFRESH_DYNAMIC, NULL },
-#endif
-
-#if CONFIG_CODEC == SWCODEC
-    { WPS_TOKEN_REPLAYGAIN,               "rg",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_CROSSFADE,                "xf",  WPS_REFRESH_DYNAMIC, NULL },
-#endif
+    { SKIN_TOKEN_TRACK_STARTING,           "pS",  0, parse_timeout },
+    { SKIN_TOKEN_TRACK_ENDING,             "pE",  0, parse_timeout },
 
-    { WPS_TOKEN_HAVE_TUNER,               "tp",  WPS_REFRESH_STATIC,  NULL },
-#if CONFIG_TUNER /* Re-uses the 't' and 'T' prefixes, be careful about doubleups */
-    { WPS_TOKEN_TUNER_TUNED,              "tt",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_TUNER_SCANMODE,           "tm",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_TUNER_STEREO,             "ts",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_TUNER_MINFREQ,            "ta",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_TUNER_MAXFREQ,            "tb",  WPS_REFRESH_STATIC,  NULL },
-    { WPS_TOKEN_TUNER_CURFREQ,            "tf",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_PRESET_ID,                "Ti",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_PRESET_NAME,              "Tn",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_PRESET_FREQ,              "Tf",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_PRESET_COUNT,             "Tc",  WPS_REFRESH_STATIC, NULL },
-    { WPS_TOKEN_HAVE_RDS,                 "tx",  WPS_REFRESH_STATIC, NULL },
-#ifdef HAVE_RDS_CAP
-    { WPS_TOKEN_RDS_NAME,                 "ty", WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_RDS_TEXT,                 "tz", WPS_REFRESH_DYNAMIC, NULL },
-#endif
-#endif /* CONFIG_TUNER */
-
-    { WPS_NO_TOKEN,                       "s",   WPS_REFRESH_SCROLL,  NULL },
-    { WPS_TOKEN_SUBLINE_TIMEOUT,          "t",   0,  parse_timeout },
+    { SKIN_TOKEN_SUBLINE_TIMEOUT,          "t",   0,  parse_timeout },
 
 #ifdef HAVE_LCD_BITMAP
-    { WPS_NO_TOKEN,                       "we",  0, parse_statusbar_enable },
-    { WPS_NO_TOKEN,                       "wd",  0, parse_statusbar_disable },
-    { WPS_TOKEN_DRAW_INBUILTBAR,          "wi",  WPS_REFRESH_DYNAMIC, parse_statusbar_inbuilt },
+    { SKIN_TOKEN_ENABLE_THEME,                       "we",  0, parse_statusbar_enable },
+    { SKIN_TOKEN_DISABLE_THEME,                       "wd",  0, parse_statusbar_disable },
+    { SKIN_TOKEN_DRAW_INBUILTBAR,          "wi",  0, parse_statusbar_inbuilt },
 
-    { WPS_NO_TOKEN,                       "xl",  0,       parse_image_load },
+    { SKIN_TOKEN_IMAGE_PRELOAD,                       "xl",  0,       parse_image_load },
 
-    { WPS_TOKEN_IMAGE_PRELOAD_DISPLAY,    "xd",  WPS_REFRESH_STATIC,
+    { SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY,    "xd",  0,
                                                        parse_image_display },
 
-    { WPS_TOKEN_IMAGE_DISPLAY,            "x",   0,       parse_image_load },
-    { WPS_NO_TOKEN,                       "Fl",  0,       parse_font_load },
+    { SKIN_TOKEN_IMAGE_DISPLAY,            "x",   0,       parse_image_load },
+    { SKIN_TOKEN_LOAD_FONT,                       "Fl",  0,       parse_font_load },
 #ifdef HAVE_ALBUMART
-    { WPS_NO_TOKEN,                       "Cl",  0,    parse_albumart_load },
-    { WPS_TOKEN_ALBUMART_DISPLAY,         "Cd",   WPS_REFRESH_STATIC,  parse_albumart_display },
-    { WPS_TOKEN_ALBUMART_FOUND,           "C", WPS_REFRESH_STATIC, NULL },
+    { SKIN_TOKEN_ALBUMART_LOAD,                       "Cl",  0,    parse_albumart_load },
 #endif
 
-    { WPS_VIEWPORT_ENABLE,                "Vd",  WPS_REFRESH_DYNAMIC,
+    { SKIN_TOKEN_VIEWPORT_ENABLE,                "Vd",  0,
                                                     parse_viewport_display },
-    { WPS_TOKEN_UIVIEWPORT_ENABLE,        "VI",  WPS_REFRESH_STATIC,
+    { SKIN_TOKEN_UIVIEWPORT_ENABLE,        "VI",  0,
                                                     parse_viewport_display },
 #ifdef HAVE_LCD_BITMAP
-    { WPS_VIEWPORT_CUSTOMLIST,            "Vp",  WPS_REFRESH_STATIC, parse_playlistview },
-    { WPS_TOKEN_LIST_TITLE_TEXT,          "Lt",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_LIST_TITLE_ICON,          "Li",  WPS_REFRESH_DYNAMIC, NULL },
+    { SKIN_TOKEN_VIEWPORT_CUSTOMLIST,            "Vp",  0, parse_playlistview },
 #endif
 #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
-    { WPS_TOKEN_VIEWPORT_FGCOLOUR,        "Vf", WPS_REFRESH_STATIC, parse_viewportcolour },
-    { WPS_TOKEN_VIEWPORT_BGCOLOUR,        "Vb", WPS_REFRESH_STATIC, parse_viewportcolour },
+    { SKIN_TOKEN_VIEWPORT_FGCOLOUR,        "Vf", 0, parse_viewportcolour },
+    { SKIN_TOKEN_VIEWPORT_BGCOLOUR,        "Vb", 0, parse_viewportcolour },
 #endif
-    { WPS_NO_TOKEN,                       "V",   0,    parse_viewport      },
-
 #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
-    { WPS_TOKEN_IMAGE_BACKDROP,           "X",   0,    parse_image_special },
+    { SKIN_TOKEN_IMAGE_BACKDROP,           "X",   0,    parse_image_special },
 #endif
 #endif
 
-    { WPS_TOKEN_SETTING,                  "St",  WPS_REFRESH_DYNAMIC,
+    { SKIN_TOKEN_SETTING,                  "St",  0,
                                                     parse_setting_and_lang },
-    { WPS_TOKEN_TRANSLATEDSTRING,         "Sx",  WPS_REFRESH_STATIC,
+    { SKIN_TOKEN_TRANSLATEDSTRING,         "Sx",  0,
                                                     parse_setting_and_lang },
-    { WPS_TOKEN_LANG_IS_RTL ,             "Sr",  WPS_REFRESH_STATIC, NULL },
 
-    { WPS_TOKEN_LASTTOUCH,                "Tl",  WPS_REFRESH_DYNAMIC, parse_timeout },
-    { WPS_TOKEN_CURRENT_SCREEN,           "cs",  WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_NO_TOKEN,                       "T",   0,    parse_touchregion      },
+    { SKIN_TOKEN_LASTTOUCH,                "Tl",  0, parse_timeout },
+    { SKIN_TOKEN_TOUCHREGION,                       "T",   0,    parse_touchregion      },
 
-
-    /* Recording Tokens */
-    { WPS_TOKEN_HAVE_RECORDING,         "Rp", WPS_REFRESH_STATIC, NULL },
-#ifdef HAVE_RECORDING
-    { WPS_TOKEN_IS_RECORDING,           "Rr", WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_REC_FREQ,               "Rf", WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_REC_ENCODER,            "Re", WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_REC_BITRATE,            "Rb", WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_REC_MONO,               "Rm", WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_REC_SECONDS,            "Rs", WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_REC_MINUTES,            "Rn", WPS_REFRESH_DYNAMIC, NULL },
-    { WPS_TOKEN_REC_HOURS,              "Rh", WPS_REFRESH_DYNAMIC, NULL },
-#endif
-    { WPS_TOKEN_UNKNOWN,                  "",    0, NULL }
+    { SKIN_TOKEN_UNKNOWN,                  "",    0, NULL }
     /* the array MUST end with an empty string (first char is \0) */
 };
 
@@ -478,10 +292,10 @@ struct gui_img* find_image(char label, struct wps_data *data)
 /* traverse the viewport linked list for a viewport */
 struct skin_viewport* find_viewport(char label, struct wps_data *data)
 {
-    struct skin_token_list *list = data->viewports;
+    struct skin_element *list = data->tree;
     while (list)
     {
-        struct skin_viewport *vp = (struct skin_viewport *)list->token->value.data;
+        struct skin_viewport *vp = (struct skin_viewport *)list->data;
         if (vp->label == label)
             return vp;
         list = list->next;
@@ -510,72 +324,6 @@ static struct skin_token_list *new_skin_token_list_item(struct wps_token *token,
     return llitem;
 }
 
-/* Returns the number of chars that should be skipped to jump
-   immediately after the first eol, i.e. to the start of the next line */
-static int skip_end_of_line(const char *wps_bufptr)
-{
-    line_number++;
-    int skip = 0;
-    while(*(wps_bufptr + skip) != '\n')
-        skip++;
-    return ++skip;
-}
-
-/* Starts a new subline in the current line during parsing */
-static bool skin_start_new_subline(struct skin_line *line, int curr_token)
-{
-    struct skin_subline *subline = skin_buffer_alloc(sizeof(struct skin_subline));
-    if (!subline)
-        return false;
-
-    subline->first_token_idx = curr_token;
-    subline->next = NULL;
-
-    subline->line_type = 0;
-    subline->time_mult = 0;
-
-    line->curr_subline->last_token_idx = curr_token-1;
-    line->curr_subline->next = subline;
-    line->curr_subline = subline;
-    return true;
-}
-
-static bool skin_start_new_line(struct skin_viewport *vp, int curr_token)
-{
-    struct skin_line *line = skin_buffer_alloc(sizeof(struct skin_line));
-    struct skin_subline *subline = NULL;
-    if (!line)
-        return false;
-
-    /* init the subline */
-    subline = &line->sublines;
-    subline->first_token_idx = curr_token;
-    subline->next = NULL;
-    subline->line_type = 0;
-    subline->time_mult = 0;
-
-    /* init the new line */
-    line->curr_subline  = &line->sublines;
-    line->next          = NULL;
-    line->subline_expire_time = 0;
-
-    /* connect to curr_line and vp pointers.
-     * 1) close the previous lines subline
-     * 2) connect to vp pointer
-     * 3) connect to curr_line global pointer
-     */
-    if (curr_line)
-    {
-        curr_line->curr_subline->last_token_idx = curr_token - 1;
-        curr_line->next = line;
-        curr_line->curr_subline = NULL;
-    }
-    curr_line = line;
-    if (!vp->lines)
-        vp->lines = line;
-    return true;
-}
-
 #ifdef HAVE_LCD_BITMAP
 
 static int parse_statusbar_enable(const char *wps_bufptr,
@@ -588,7 +336,7 @@ static int parse_statusbar_enable(const char *wps_bufptr,
     struct skin_viewport *default_vp = find_viewport(VP_DEFAULT_LABEL, wps_data);
     viewport_set_defaults(&default_vp->vp, curr_screen);
     default_vp->vp.font = FONT_UI;
-    return skip_end_of_line(wps_bufptr);
+    return 0;
 }
 
 static int parse_statusbar_disable(const char *wps_bufptr,
@@ -601,7 +349,7 @@ static int parse_statusbar_disable(const char *wps_bufptr,
     struct skin_viewport *default_vp = find_viewport(VP_DEFAULT_LABEL, wps_data);
     viewport_set_fullscreen(&default_vp->vp, curr_screen);
     default_vp->vp.font = FONT_UI;
-    return skip_end_of_line(wps_bufptr);
+    return 0;
 }
 
 static int parse_statusbar_inbuilt(const char *wps_bufptr,
@@ -609,7 +357,7 @@ static int parse_statusbar_inbuilt(const char *wps_bufptr,
 {
     (void)wps_data;
     token->value.data = (void*)&curr_vp->vp;
-    return skip_end_of_line(wps_bufptr);
+    return 0;
 }
 
 static int get_image_id(int c)
@@ -711,7 +459,8 @@ static int parse_image_load(const char *wps_bufptr,
     if (!img)
         return WPS_ERROR_INVALID_PARAM;
     /* save a pointer to the filename */
-    img->bm.data = (char*)filename;
+    img->bm.data = skin_buffer_alloc(strlen(filename));
+    strcpy(img->bm.data, filename);
     img->label = *id;
     img->x = x;
     img->y = y;
@@ -721,7 +470,7 @@ static int parse_image_load(const char *wps_bufptr,
     /* save current viewport */
     img->vp = &curr_vp->vp;
 
-    if (token->type == WPS_TOKEN_IMAGE_DISPLAY)
+    if (token->type == SKIN_TOKEN_IMAGE_DISPLAY)
     {
         img->always_display = true;
     }
@@ -744,7 +493,7 @@ static int parse_image_load(const char *wps_bufptr,
     add_to_ll_chain(&wps_data->images, item);
 
     /* Skip the rest of the line */
-    return skip_end_of_line(wps_bufptr);
+    return 0;
 }
 struct skin_font {
     int id; /* the id from font_load */
@@ -785,9 +534,10 @@ static int parse_font_load(const char *wps_bufptr,
     if (!ptr || strncmp(ptr, ".fnt)", 5))
         return WPS_ERROR_INVALID_PARAM;
     skinfonts[id-FONT_FIRSTUSERFONT].id = -1;
-    skinfonts[id-FONT_FIRSTUSERFONT].name = filename;
+    skinfonts[id-FONT_FIRSTUSERFONT].name = skin_buffer_alloc(strlen(filename));
+    strcpy(skinfonts[id-FONT_FIRSTUSERFONT].name, filename);
 
-    return skip_end_of_line(wps_bufptr);
+    return 0;
 }
 
 
@@ -838,7 +588,7 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
                 case ')':
                 case ',':
                     /* escaped characters */
-                    viewer->lines[line].tokens[viewer->lines[line].count++] = WPS_TOKEN_CHARACTER;
+                    viewer->lines[line].tokens[viewer->lines[line].count++] = SKIN_TOKEN_CHARACTER;
                     viewer->lines[line].strings[cur_string][0] = *text;
                     viewer->lines[line].strings[cur_string++][1] = '\0';
                     text++;
@@ -848,7 +598,7 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
                      strncmp(text, tag->name, strlen(tag->name)) != 0;
                      tag++) ;
                 /* %s isnt stored as a tag so manually check for it */
-                if (tag->type == WPS_NO_TOKEN)
+                if (tag->type == SKIN_TOKEN_NO_TOKEN)
                 {
                     if (!strncmp(tag->name, "s", 1))
                     {
@@ -856,11 +606,11 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
                         taglen = 1;
                     }
                 }
-                else if (tag->type == WPS_TOKEN_UNKNOWN)
+                else if (tag->type == SKIN_TOKEN_UNKNOWN)
                 {
                     int i = 0;
                     /* just copy the string */
-                    viewer->lines[line].tokens[viewer->lines[line].count++] = WPS_TOKEN_STRING;
+                    viewer->lines[line].tokens[viewer->lines[line].count++] = SKIN_TOKEN_STRING;
                     while (i<(MAX_PLAYLISTLINE_STRLEN-1) && text[i] != ',' && text[i] != ')' && text[i] != '%')
                     {
                         viewer->lines[line].strings[cur_string][i] = text[i];
@@ -888,7 +638,7 @@ static int parse_playlistview_text(struct playlistviewer *viewer,
             /* regular string */
             int i = 0;
             /* just copy the string */
-            viewer->lines[line].tokens[viewer->lines[line].count++] = WPS_TOKEN_STRING;
+            viewer->lines[line].tokens[viewer->lines[line].count++] = SKIN_TOKEN_STRING;
             while (i<(MAX_PLAYLISTLINE_STRLEN-1) && text[i] != ',' && text[i] != ')' && text[i] != '%')
             {
                 viewer->lines[line].strings[cur_string][i] = text[i];
@@ -924,107 +674,10 @@ static int parse_playlistview(const char *wps_bufptr,
     if (length < 0)
         return WPS_ERROR_INVALID_PARAM;
 
-    return skip_end_of_line(wps_bufptr);
+    return 0;
 }
 #endif
 
-static int parse_viewport(const char *wps_bufptr,
-                          struct wps_token *token,
-                          struct wps_data *wps_data)
-{
-    (void)token; /* Kill warnings */
-    const char *ptr = wps_bufptr;
-
-    struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(struct skin_viewport));
-
-    /* check for the optional letter to signify its a hideable viewport */
-    /* %Vl|<label>|<rest of tags>| */
-    skin_vp->hidden_flags = 0;
-    skin_vp->label = VP_NO_LABEL;
-    skin_vp->lines  = NULL;
-    if (curr_line)
-    {
-        curr_line->curr_subline->last_token_idx = wps_data->num_tokens
-                        - (wps_data->num_tokens > 0 ? 1 : 0);
-    }
-
-    curr_line = NULL;
-    if (!skin_start_new_line(skin_vp, wps_data->num_tokens))
-        return WPS_ERROR_INVALID_PARAM;
-
-    if (*ptr == 'i')
-    {
-        if (*(ptr+1) == '(')
-        {
-            char label = *(ptr+2);
-            if (label >= 'a' && label <= 'z')
-            {
-                skin_vp->hidden_flags = VP_NEVER_VISIBLE;
-                skin_vp->label = VP_INFO_LABEL|label;
-                ptr += 3;
-            }
-            else
-            {
-                if (label != '-')
-                    return WPS_ERROR_INVALID_PARAM;
-                skin_vp->label = VP_INFO_LABEL|VP_DEFAULT_LABEL;
-                skin_vp->hidden_flags = VP_NEVER_VISIBLE;
-                ptr += 3;
-            }
-        }
-        else
-            return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl7  */
-    }
-    else if (*ptr == 'l')
-    {
-        if (*(ptr+1) == '(')
-        {
-            char label = *(ptr+2);
-            if (label >= 'a' && label <= 'z')
-            {
-                skin_vp->hidden_flags = VP_DRAW_HIDEABLE;
-                skin_vp->label = label;
-            }
-            else
-                return WPS_ERROR_INVALID_PARAM; /* malformed token: e.g. %Cl7  */
-            ptr += 3;
-        }
-    }
-    if (*ptr != ',' && *ptr != '(')
-        return WPS_ERROR_INVALID_PARAM;
-
-    ptr++;
-    struct viewport *vp = &skin_vp->vp;
-    /* format: %V|x|y|width|height|font| */
-    if (!(ptr = viewport_parse_viewport(vp, curr_screen, ptr, ',')))
-        return WPS_ERROR_INVALID_PARAM;
-
-    /* Check for trailing ) */
-    if (*ptr != ')')
-        return WPS_ERROR_INVALID_PARAM;
-    ptr++;
-
-    if (follow_lang_direction && lang_is_rtl())
-    {
-        vp->flags |= VP_FLAG_ALIGN_RIGHT;
-        vp->x = screens[curr_screen].lcdwidth - vp->width - vp->x;
-    }
-    else
-        vp->flags &= ~VP_FLAG_ALIGN_RIGHT; /* ignore right-to-left languages */
-
-#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
-    skin_vp->start_fgcolour = vp->fg_pattern;
-    skin_vp->start_bgcolour = vp->bg_pattern;
-#endif
-
-    struct skin_token_list *list = new_skin_token_list_item(NULL, skin_vp);
-    if (!list)
-        return WPS_ERROR_INVALID_PARAM;
-    add_to_ll_chain(&wps_data->viewports, list);
-    curr_vp = skin_vp;
-    /* Skip the rest of the line */
-    return ptr-wps_bufptr;
-}
 #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
 static int parse_viewportcolour(const char *wps_bufptr,
         struct wps_token *token, struct wps_data *wps_data)
@@ -1044,24 +697,27 @@ static int parse_viewportcolour(const char *wps_bufptr,
         return -1;
     if (!set)
         colour->colour = get_viewport_default_colour(curr_screen,
-                                        token->type == WPS_TOKEN_VIEWPORT_FGCOLOUR);
+                                        token->type == SKIN_TOKEN_VIEWPORT_FGCOLOUR);
     colour->vp = &curr_vp->vp;
     token->value.data = colour;
     /* If there havnt been any text tags between the %V() line and here use
      * the colour as the viewport colour. fixes scrolling lines not
-     * having the correct colour */
+     * having the correct colour 
     i = curr_vp->lines->sublines.first_token_idx;
     found_text = false;
     while (!found_text && i< curr_vp->lines->sublines.last_token_idx)
     {
-        if (wps_data->tokens[i++].type != WPS_TOKEN_CHARACTER &&
-            wps_data->tokens[i++].type != WPS_TOKEN_VIEWPORT_FGCOLOUR && 
-            wps_data->tokens[i++].type != WPS_TOKEN_VIEWPORT_BGCOLOUR )
+        if (wps_data->tokens[i++].type != SKIN_TOKEN_CHARACTER &&
+            wps_data->tokens[i++].type != SKIN_TOKEN_VIEWPORT_FGCOLOUR && 
+            wps_data->tokens[i++].type != SKIN_TOKEN_VIEWPORT_BGCOLOUR )
             found_text = true;
     }
+    FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME 
+    */
+    found_text = false;
     if (!found_text)
     {
-        if (token->type == WPS_TOKEN_VIEWPORT_FGCOLOUR)
+        if (token->type == SKIN_TOKEN_VIEWPORT_FGCOLOUR)
         {
             curr_vp->start_fgcolour = colour->colour;
             curr_vp->vp.fg_pattern = colour->colour;
@@ -1092,22 +748,26 @@ static int parse_image_special(const char *wps_bufptr,
     error = (pos > newline);
 
 #if LCD_DEPTH > 1
-    if (token->type == WPS_TOKEN_IMAGE_BACKDROP)
+    if (token->type == SKIN_TOKEN_IMAGE_BACKDROP)
     {
         /* format: %X|filename.bmp| or %Xd */
         if (!strncmp(wps_bufptr, "(d)", 3))
         {
             wps_data->backdrop = NULL;
-            return skip_end_of_line(wps_bufptr);
+            return 0;
         }
         else if (!error)
-            wps_data->backdrop = (char*)wps_bufptr + 1;
+        {
+            char *filename = (char*)wps_bufptr + 1;
+            wps_data->backdrop = skin_buffer_alloc(strlen(filename));
+            strcpy(wps_data->backdrop, filename);
+        }
     }
 #endif
     if (error)
         return WPS_ERROR_INVALID_PARAM;
     /* Skip the rest of the line */
-    return skip_end_of_line(wps_bufptr);
+    return 0;
 }
 #endif
 
@@ -1137,7 +797,7 @@ static int parse_setting_and_lang(const char *wps_bufptr,
         return WPS_ERROR_INVALID_PARAM;
     strlcpy(temp, ptr,end-ptr+1);
     
-    if (token->type == WPS_TOKEN_TRANSLATEDSTRING)
+    if (token->type == SKIN_TOKEN_TRANSLATEDSTRING)
     {
 #ifndef __PCTOOL__
         i = lang_english_to_id(temp);
@@ -1223,16 +883,18 @@ static int parse_timeout(const char *wps_bufptr,
         /* decide what to do if no value was specified */
         switch (token->type)
         {
-            case WPS_TOKEN_SUBLINE_TIMEOUT:
+            case SKIN_TOKEN_SUBLINE_TIMEOUT:
                 return -1;
-            case WPS_TOKEN_BUTTON_VOLUME:
-            case WPS_TOKEN_TRACK_STARTING:
-            case WPS_TOKEN_TRACK_ENDING:
+            case SKIN_TOKEN_BUTTON_VOLUME:
+            case SKIN_TOKEN_TRACK_STARTING:
+            case SKIN_TOKEN_TRACK_ENDING:
                 val = 10;
                 break;
         }
     }
     token->value.i = val;
+    if (token->type == SKIN_TOKEN_SUBLINE_TIMEOUT)
+        curr_line->timeout = val;
 
     return skip;
 }
@@ -1262,15 +924,17 @@ static int parse_progressbar(const char *wps_bufptr,
         return WPS_ERROR_INVALID_PARAM;
 
     struct viewport *vp = &curr_vp->vp;
-    /* we need to know what line number (viewport relative) this pb is,
+    /* FIXME we need to know what line number (viewport relative) this pb is,
      * so count them... */
     int line_num = -1;
+    /*
     struct skin_line *line = curr_vp->lines;
     while (line)
     {
         line_num++;
         line = line->next;
     }
+    */
     if (curr_vp->label != VP_DEFAULT_LABEL)
         line_num--;
     pb->vp = vp;
@@ -1285,7 +949,7 @@ static int parse_progressbar(const char *wps_bufptr,
         pb->width = vp->width;
         pb->height = SYSFONT_HEIGHT-2;
         pb->y = -line_num - 1; /* Will be computed during the rendering */
-        if (token->type == WPS_TOKEN_VOLUME || token->type == WPS_TOKEN_BATTERY_PERCENT)
+        if (token->type == SKIN_TOKEN_VOLUME || token->type == SKIN_TOKEN_BATTERY_PERCENT)
             return 0; /* dont add it, let the regular token handling do the work */
         pb->type = token->type;
         add_to_ll_chain(&wps_data->progressbars, item);
@@ -1298,7 +962,10 @@ static int parse_progressbar(const char *wps_bufptr,
         return WPS_ERROR_INVALID_PARAM;
 
     if (LIST_VALUE_PARSED(set, PB_FILENAME)) /* filename */
-        pb->bm.data = (char*)filename;
+    {
+        pb->bm.data = skin_buffer_alloc(strlen(filename));
+        strcpy(pb->bm.data, filename);
+    }
 
     if (LIST_VALUE_PARSED(set, PB_X)) /* x */
         pb->x = x;
@@ -1347,20 +1014,20 @@ static int parse_progressbar(const char *wps_bufptr,
         return WPS_ERROR_INVALID_PARAM;
 
     add_to_ll_chain(&wps_data->progressbars, item);
-    if (token->type == WPS_TOKEN_VOLUME)
-        token->type = WPS_TOKEN_VOLUMEBAR;
-    else if (token->type == WPS_TOKEN_BATTERY_PERCENT)
-        token->type = WPS_TOKEN_BATTERY_PERCENTBAR;
+    if (token->type == SKIN_TOKEN_VOLUME)
+        token->type = SKIN_TOKEN_VOLUMEBAR;
+    else if (token->type == SKIN_TOKEN_BATTERY_PERCENT)
+        token->type = SKIN_TOKEN_BATTERY_PERCENTBAR;
     pb->type = token->type;
 
     return ptr+1-wps_bufptr;
 #else
     (void)wps_bufptr;
-    if (token->type != WPS_TOKEN_VOLUME &&
-        token->type != WPS_TOKEN_BATTERY_PERCENTBAR)
+    if (token->type != SKIN_TOKEN_VOLUME &&
+        token->type != SKIN_TOKEN_BATTERY_PERCENTBAR)
     {
         wps_data->full_line_progressbar = 
-                        token->type == WPS_TOKEN_PLAYER_PROGRESSBAR;
+                        token->type == SKIN_TOKEN_PLAYER_PROGRESSBAR;
     }
     return 0;
 
@@ -1379,14 +1046,13 @@ static int parse_albumart_load(const char *wps_bufptr,
     struct skin_albumart *aa = skin_buffer_alloc(sizeof(struct skin_albumart));
     (void)token; /* silence warning */
     if (!aa)
-        return skip_end_of_line(wps_bufptr);
+        return 0;
 
     /* reset albumart info in wps */
     aa->width = -1;
     aa->height = -1;
     aa->xalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
     aa->yalign = WPS_ALBUMART_ALIGN_CENTER; /* default */
-    aa->vp = &curr_vp->vp;
 
     if (*ptr != '(')
         return WPS_ERROR_INVALID_PARAM; 
@@ -1410,7 +1076,6 @@ static int parse_albumart_load(const char *wps_bufptr,
         aa->x = LCD_WIDTH - (aa->x + aa->width);
 
     aa->state = WPS_ALBUMART_LOAD;
-    aa->draw = false;
     wps_data->albumart = aa;
 
     dimensions.width = aa->width;
@@ -1470,27 +1135,9 @@ static int parse_albumart_load(const char *wps_bufptr,
     if (*ptr != ')')
         return WPS_ERROR_INVALID_PARAM;
 
-    return skip_end_of_line(wps_bufptr);
+    return 0;
 }
 
-static int parse_albumart_display(const char *wps_bufptr,
-                                      struct wps_token *token,
-                                      struct wps_data *wps_data)
-{
-    (void)wps_bufptr;
-    (void)token;
-    if (wps_data->albumart)
-    {
-        wps_data->albumart->vp = &curr_vp->vp;
-    }
-#if 0
-    /* the old code did this so keep it here for now...
-     * this is to allow the posibility to showing the next tracks AA! */
-    if (wps_bufptr+1 == 'n')
-        return 1;
-#endif
-    return 0;
-};
 #endif /* HAVE_ALBUMART */
 
 #ifdef HAVE_TOUCHSCREEN
@@ -1625,15 +1272,15 @@ static int parse_touchregion(const char *wps_bufptr,
     if (!item)
         return WPS_ERROR_INVALID_PARAM;
     add_to_ll_chain(&wps_data->touchregions, item);
-    return skip_end_of_line(wps_bufptr);
+    return 0;
 }
 #endif
-
+#if 0
 /* Parse a generic token from the given string. Return the length read */
 static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
 {
     int skip = 0, taglen = 0, ret;
-    struct wps_token *token = wps_data->tokens + wps_data->num_tokens;
+    struct wps_token *token = skin_buffer_alloc(sizeof(*token));
     const struct wps_tag *tag;
     memset(token, 0, sizeof(*token));
 
@@ -1650,7 +1297,7 @@ static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
         case '(':
         case ',':
             /* escaped characters */
-            token->type = WPS_TOKEN_CHARACTER;
+            token->type = SKIN_TOKEN_CHARACTER;
             token->value.c = *wps_bufptr;
             taglen = 1;
             wps_data->num_tokens++;
@@ -1658,7 +1305,7 @@ static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
 
         case '?':
             /* conditional tag */
-            token->type = WPS_TOKEN_CONDITIONAL;
+            token->type = SKIN_TOKEN_CONDITIONAL;
             level++;
             condindex[level] = wps_data->num_tokens;
             numoptions[level] = 1;
@@ -1674,9 +1321,9 @@ static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
                  strncmp(wps_bufptr, tag->name, strlen(tag->name)) != 0;
                  tag++) ;
 
-            taglen = (tag->type != WPS_TOKEN_UNKNOWN) ? strlen(tag->name) : 2;
+            taglen = (tag->type != SKIN_TOKEN_UNKNOWN) ? strlen(tag->name) : 2;
             token->type = tag->type;
-            curr_line->curr_subline->line_type |= tag->refresh_type;
+       //     curr_line->curr_subline->line_type |= tag->refresh_type;
 
             /* if the tag has a special parsing function, we call it */
             if (tag->parse_func)
@@ -1702,7 +1349,7 @@ static int parse_token(const char *wps_bufptr, struct wps_data *wps_data)
     skip += taglen;
     return skip;
 }
-
+#endif
 
 /*
  * Returns the number of bytes to skip the buf pointer to access the false
@@ -1763,301 +1410,34 @@ static int find_false_branch(const char *wps_bufptr)
  *    parse the true branch at all
  *
  * */
-static int check_feature_tag(const char *wps_bufptr, const int type)
+static bool check_feature_tag(const int type)
 {
-    (void)wps_bufptr;
     switch (type)
     {
-        case WPS_TOKEN_RTC_PRESENT:
+        case SKIN_TOKEN_RTC_PRESENT:
 #if CONFIG_RTC
-            return 0;
+            return true;
 #else
-            return find_false_branch(wps_bufptr);
+            return false;
 #endif
-        case WPS_TOKEN_HAVE_RECORDING:
+        case SKIN_TOKEN_HAVE_RECORDING:
 #ifdef HAVE_RECORDING
-            return 0;
+            return true;
 #else
-            return find_false_branch(wps_bufptr);
+            return false;
 #endif
-        case WPS_TOKEN_HAVE_TUNER:
+        case SKIN_TOKEN_HAVE_TUNER:
 #if CONFIG_TUNER
             if (radio_hardware_present())
-                return 0;
+                return true;
 #endif
-            return find_false_branch(wps_bufptr);
+            return false;
 
         default: /* not a tag we care about, just don't skip */
-            return 0;
-    }
-}
-
-
-/* Parses the WPS.
-   data is the pointer to the structure where the parsed WPS should be stored.
-        It is initialised.
-   wps_bufptr points to the string containing the WPS tags */
-#define TOKEN_BLOCK_SIZE 128
-static bool wps_parse(struct wps_data *data, const char *wps_bufptr, bool debug)
-{
-    if (!data || !wps_bufptr || !*wps_bufptr)
-        return false;
-    enum wps_parse_error fail = PARSE_OK;
-    int ret;
-    int max_tokens = TOKEN_BLOCK_SIZE;
-    size_t buf_free = 0;
-    line_number = 0;
-    level = -1;
-
-    /* allocate enough RAM for a reasonable skin, grow as needed.
-     * Free any used RAM before loading the images to be 100% RAM efficient */
-    data->tokens = (struct wps_token *)skin_buffer_grab(&buf_free);
-    if (sizeof(struct wps_token)*max_tokens >= buf_free)
-        return false;
-    skin_buffer_increment(max_tokens * sizeof(struct wps_token), false);
-    data->num_tokens = 0;
-
-#if LCD_DEPTH > 1
-    /* Backdrop defaults to the setting unless %X is used, so set it now */
-    if (global_settings.backdrop_file[0])
-    {
-        data->backdrop = "-";
-    }
-#endif
-
-    while (*wps_bufptr && !fail)
-    {
-        if (follow_lang_direction)
-            follow_lang_direction--;
-        /* first make sure there is enough room for tokens */
-        if (max_tokens <= data->num_tokens + 5)
-        {
-            int extra_tokens = TOKEN_BLOCK_SIZE;
-            size_t needed = extra_tokens * sizeof(struct wps_token);
-            /* do some smarts here to grow the array a bit */
-            if (skin_buffer_freespace() < needed)
-            {
-                fail = PARSE_FAIL_LIMITS_EXCEEDED;
-                break;
-            }
-            skin_buffer_increment(needed, false);
-            max_tokens += extra_tokens;
-        }
-
-        switch(*wps_bufptr++)
-        {
-
-            /* Regular tag */
-            case '%':
-                if ((ret = parse_token(wps_bufptr, data)) < 0)
-                {
-                    fail = PARSE_FAIL_COND_INVALID_PARAM;
-                    break;
-                }
-                else if (level >= WPS_MAX_COND_LEVEL - 1)
-                {
-                    fail = PARSE_FAIL_LIMITS_EXCEEDED;
-                    break;
-                }
-                wps_bufptr += ret;
-                break;
-
-            /* Alternating sublines separator */
-            case ';':
-                if (level >= 0) /* there are unclosed conditionals */
-                {
-                    fail = PARSE_FAIL_UNCLOSED_COND;
-                    break;
-                }
-
-                if (!skin_start_new_subline(curr_line, data->num_tokens))
-                    fail = PARSE_FAIL_LIMITS_EXCEEDED;
-
-                break;
-
-            /* Conditional list start */
-            case '<':
-                if (data->tokens[data->num_tokens-2].type != WPS_TOKEN_CONDITIONAL)
-                {
-                    fail = PARSE_FAIL_COND_SYNTAX_ERROR;
-                    break;
-                }
-                wps_bufptr += check_feature_tag(wps_bufptr,
-                                    data->tokens[data->num_tokens-1].type);
-                data->tokens[data->num_tokens].type = WPS_TOKEN_CONDITIONAL_START;
-                lastcond[level] = data->num_tokens++;
-                break;
-
-            /* Conditional list end */
-            case '>':
-                if (level < 0) /* not in a conditional, invalid char */
-                {
-                    fail = PARSE_FAIL_INVALID_CHAR;
-                    break;
-                }
-
-                data->tokens[data->num_tokens].type = WPS_TOKEN_CONDITIONAL_END;
-                if (lastcond[level])
-                    data->tokens[lastcond[level]].value.i = data->num_tokens;
-                else
-                {
-                    fail = PARSE_FAIL_COND_SYNTAX_ERROR;
-                    break;
-                }
-
-                lastcond[level] = 0;
-                data->num_tokens++;
-                data->tokens[condindex[level]].value.i = numoptions[level];
-                level--;
-                break;
-
-            /* Conditional list option */
-            case '|':
-                if (level < 0) /* not in a conditional, invalid char */
-                {
-                    fail = PARSE_FAIL_INVALID_CHAR;
-                    break;
-                }
-
-                data->tokens[data->num_tokens].type = WPS_TOKEN_CONDITIONAL_OPTION;
-                if (lastcond[level])
-                    data->tokens[lastcond[level]].value.i = data->num_tokens;
-                else
-                {
-                    fail = PARSE_FAIL_COND_SYNTAX_ERROR;
-                    break;
-                }
-
-                lastcond[level] = data->num_tokens;
-                numoptions[level]++;
-                data->num_tokens++;
-                break;
-
-            /* Comment */
-            case '#':
-                if (level >= 0) /* there are unclosed conditionals */
-                {
-                    fail = PARSE_FAIL_UNCLOSED_COND;
-                    break;
-                }
-
-                wps_bufptr += skip_end_of_line(wps_bufptr);
-                break;
-
-            /* End of this line */
-            case '\n':
-                if (level >= 0) /* there are unclosed conditionals */
-                {
-                    fail = PARSE_FAIL_UNCLOSED_COND;
-                    break;
-                }
-                /* add a new token for the \n so empty lines are correct */
-                data->tokens[data->num_tokens].type = WPS_TOKEN_CHARACTER;
-                data->tokens[data->num_tokens].value.c = '\n';
-                data->tokens[data->num_tokens].next = false;
-                data->num_tokens++;
-
-                if (!skin_start_new_line(curr_vp, data->num_tokens))
-                {
-                    fail = PARSE_FAIL_LIMITS_EXCEEDED;
-                    break;
-                }
-                line_number++;
-
-                break;
-
-            /* String */
-            default:
-                {
-                    unsigned int len = 1;
-                    const char *string_start = wps_bufptr - 1;
-
-                    /* find the length of the string */
-                    while (*wps_bufptr && *wps_bufptr != '#' &&
-                           *wps_bufptr != '%' && *wps_bufptr != ';' &&
-                           *wps_bufptr != '<' && *wps_bufptr != '>' &&
-                           *wps_bufptr != '|' && *wps_bufptr != '\n')
-                    {
-                        wps_bufptr++;
-                        len++;
-                    }
-
-                    /* look if we already have that string */
-                    char *str;
-                    bool found = false;
-                    struct skin_token_list *list = data->strings;
-                    while (list)
-                    {
-                        str = (char*)list->token->value.data;
-                        found = (strlen(str) == len &&
-                                    strncmp(string_start, str, len) == 0);
-                        if (found)
-                            break; /* break here because the list item is
-                                      used if its found */
-                        list = list->next;
-                    }
-                    /* If a matching string is found, found is true and i is
-                       the index of the string. If not, found is false */
-
-                    if (!found)
-                    {
-                        /* new string */
-                        str = (char*)skin_buffer_alloc(len+1);
-                        if (!str)
-                        {
-                            fail = PARSE_FAIL_LIMITS_EXCEEDED;
-                            break;
-                        }
-                        strlcpy(str, string_start, len+1);
-                        struct skin_token_list *item =
-                            new_skin_token_list_item(&data->tokens[data->num_tokens], str);
-                        if(!item)
-                        {
-                            fail = PARSE_FAIL_LIMITS_EXCEEDED;
-                            break;
-                        }
-                        add_to_ll_chain(&data->strings, item);
-                    }
-                    else
-                    {
-                        /* another occurrence of an existing string */
-                        data->tokens[data->num_tokens].value.data = list->token->value.data;
-                    }
-                    data->tokens[data->num_tokens].type = WPS_TOKEN_STRING;
-                    data->num_tokens++;
-                }
-                break;
-        }
+            return true;
     }
-
-    if (!fail && level >= 0) /* there are unclosed conditionals */
-        fail = PARSE_FAIL_UNCLOSED_COND;
-
-    if (*wps_bufptr && !fail)
-        /* one of the limits of the while loop was exceeded */
-        fail = PARSE_FAIL_LIMITS_EXCEEDED;
-
-    /* Success! */
-    curr_line->curr_subline->last_token_idx = data->num_tokens;
-    data->tokens[data->num_tokens++].type = WPS_NO_TOKEN;
-    /* freeup unused tokens */
-    skin_buffer_free_from_front(sizeof(struct wps_token)
-                                * (max_tokens - data->num_tokens));
-
-#ifdef DEBUG_SKIN_ENGINE
-    if (debug)
-    {
-        print_debug_info(data, fail, line_number);
-        debug_skin_usage();
-    }
-#else
-    (void)debug;
-#endif
-
-    return (fail == 0);
 }
 
-
 /*
  * initial setup of wps_data; does reset everything
  * except fields which need to survive, i.e.
@@ -2075,8 +1455,6 @@ static void skin_data_reset(struct wps_data *wps_data)
 #ifdef HAVE_TOUCHSCREEN
     wps_data->touchregions = NULL;
 #endif
-    wps_data->viewports = NULL;
-    wps_data->strings = NULL;
 #ifdef HAVE_ALBUMART
     wps_data->albumart = NULL;
     if (wps_data->playback_aa_slot >= 0)
@@ -2086,7 +1464,6 @@ static void skin_data_reset(struct wps_data *wps_data)
     }
 #endif
     wps_data->tokens = NULL;
-    wps_data->num_tokens = 0;
 
 #ifdef HAVE_LCD_BITMAP
     wps_data->peak_meter_enabled = false;
@@ -2194,14 +1571,14 @@ static bool skin_load_fonts(struct wps_data *data)
 {
     /* don't spit out after the first failue to aid debugging */
     bool success = true;
-    struct skin_token_list *vp_list;
+    struct skin_element *vp_list;
     int font_id;
     /* walk though each viewport and assign its font */
-    for(vp_list = data->viewports; vp_list; vp_list = vp_list->next)
+    for(vp_list = data->tree; vp_list; vp_list = vp_list->next)
     {
         /* first, find the viewports that have a non-sys/ui-font font */
         struct skin_viewport *skin_vp =
-                (struct skin_viewport*)vp_list->token->value.data;
+                (struct skin_viewport*)vp_list->data;
         struct viewport *vp = &skin_vp->vp;
 
 
@@ -2248,6 +1625,236 @@ static bool skin_load_fonts(struct wps_data *data)
 }
 
 #endif /* HAVE_LCD_BITMAP */
+static int convert_viewport(struct wps_data *data, struct skin_element* element)
+{
+    struct skin_viewport *skin_vp = skin_buffer_alloc(sizeof(struct skin_viewport));
+    struct screen *display = &screens[curr_screen];
+    
+    if (!skin_vp)
+        return CALLBACK_ERROR;
+        
+    skin_vp->hidden_flags = 0;
+    skin_vp->label = VP_NO_LABEL;
+    element->data = skin_vp;
+    
+    viewport_set_defaults(&skin_vp->vp, curr_screen);
+    
+#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
+    skin_vp->start_fgcolour = skin_vp->vp.fg_pattern;
+    skin_vp->start_bgcolour = skin_vp->vp.bg_pattern;
+#endif
+    
+
+    struct skin_tag_parameter *param = element->params;
+    if (element->params_count == 0) /* default viewport */
+    {
+        if (!data->tree) /* FIXME */
+            data->tree = element;
+        skin_vp->label = VP_DEFAULT_LABEL;
+        curr_vp = skin_vp;
+        return CALLBACK_OK;
+    }
+    
+    if (element->params_count == 6)
+    {
+        if (element->tag->type == SKIN_TOKEN_UIVIEWPORT_LOAD)
+        {
+            if (isdefault(param))
+            {
+                skin_vp->hidden_flags = VP_NEVER_VISIBLE;
+                skin_vp->label = VP_INFO_LABEL|VP_DEFAULT_LABEL;
+            }
+            else
+            {
+                skin_vp->hidden_flags = VP_NEVER_VISIBLE;
+                skin_vp->label = VP_INFO_LABEL|param->data.text[0];
+            }
+        }
+        else
+        {
+                skin_vp->hidden_flags = VP_DRAW_HIDEABLE;
+                skin_vp->label = param->data.text[0];
+        }
+        param++;
+    }
+    /* x */
+    if (!isdefault(param))
+    {
+        skin_vp->vp.x = param->data.numeric;
+        if (param->data.numeric < 0)
+            skin_vp->vp.x += display->lcdwidth;
+    }
+    param++;
+    /* y */
+    if (!isdefault(param))
+    {
+        skin_vp->vp.y = param->data.numeric;
+        if (param->data.numeric < 0)
+            skin_vp->vp.y += display->lcdheight;
+    }
+    param++;
+    /* width */
+    if (!isdefault(param))
+    {
+        skin_vp->vp.width = param->data.numeric;
+        if (param->data.numeric < 0)
+            skin_vp->vp.width = (skin_vp->vp.width + display->lcdwidth) - skin_vp->vp.x;
+    }
+    else
+    {
+        skin_vp->vp.width = display->lcdwidth - skin_vp->vp.x;
+    }
+    param++;
+    /* height */
+    if (!isdefault(param))
+    {
+        skin_vp->vp.height = param->data.numeric;
+        if (param->data.numeric < 0)
+            skin_vp->vp.height = (skin_vp->vp.height + display->lcdheight) - skin_vp->vp.y;
+    }
+    else
+    {
+        skin_vp->vp.height = display->lcdheight - skin_vp->vp.y;
+    }
+    param++;
+    /* font */
+    if (!isdefault(param))
+    {
+        skin_vp->vp.font = param->data.numeric;
+    }
+
+    curr_vp = skin_vp;
+    
+    return CALLBACK_OK;
+    
+}
+
+int skin_element_callback(struct skin_element* element, void* data)
+{
+    struct wps_data *wps_data = (struct wps_data *)data;
+    struct wps_token *token;
+    static char text[MAX_PATH];
+    int i;
+    
+    switch (element->type)
+    {
+        case TAG:
+        {
+            const struct wps_tag *tag;
+            token = skin_buffer_alloc(sizeof(struct wps_token));
+            memset(token, 0, sizeof(*token));
+            text[0] = '\0';
+            if (element->params_count > 0)
+            {
+                for(i=0;i<element->params_count;i++)
+                {
+                    struct skin_tag_parameter *p = &element->params[i];
+                    char temp[64]; 
+                    switch (p->type)
+                    {
+                        case NUMERIC:
+                            snprintf(temp, sizeof(temp), "%c%d", 
+                                    i==0?'(':',', p->data.numeric);
+                            break;
+                        case STRING:
+                            snprintf(temp, sizeof(temp), "%c%s", 
+                                    i==0?'(':',', p->data.text);
+                            break;
+                        case DEFAULT:
+                            snprintf(temp, sizeof(temp), "%c-", 
+                                    i==0?'(':',');
+                            break;
+                        case CODE:
+                            /* FIXME */
+                            break;
+                    }
+                    strlcat(text, temp, sizeof(text));
+                }
+                strlcat(text, ")\n", sizeof(text));
+            }
+
+            token->type = element->tag->type;
+            token->value.i = 0;
+            
+            if ((element->tag->flags&SKIN_REFRESH_ALL) == SKIN_RTC_REFRESH)
+            {
+#ifdef CONFIG_RTC
+                curr_line->update_mode |= SKIN_REFRESH_DYNAMIC;
+#else
+                curr_line->update_mode |= SKIN_REFRESH_STATIC;
+#endif
+            }
+            else
+                curr_line->update_mode |= element->tag->flags&SKIN_REFRESH_ALL;
+            
+            /* tags that start with 'F', 'I' or 'D' are for the next file */
+            if ( *(element->tag->name) == 'I' || *(element->tag->name) == 'F' ||
+                 *(element->tag->name) == 'D')
+                token->next = true;
+            
+            element->data = token;
+            
+            /* if the tag has a special parsing function, we call it */
+            for (tag = all_tags; tag->type!=SKIN_TOKEN_UNKNOWN && 
+                                 element->tag->type != tag->type; tag++) ;
+            if (tag->type != SKIN_TOKEN_UNKNOWN && tag->parse_func)
+            {
+                int retval = tag->parse_func(text, token, wps_data);
+                if (retval < 0)
+                {
+                    return CALLBACK_ERROR;
+                }
+            }
+            if (follow_lang_direction > 0 )
+                follow_lang_direction--;
+
+            break;
+        }
+        case VIEWPORT:
+            return convert_viewport(wps_data, element);
+        case LINE:
+        {
+            struct line *line = skin_buffer_alloc(sizeof(struct line));
+            line->update_mode = SKIN_REFRESH_STATIC;
+            line->timeout = DEFAULT_SUBLINE_TIME_MULTIPLIER * TIMEOUT_UNIT;
+            curr_line = line;
+            element->data = line;
+        }
+        break;
+        case LINE_ALTERNATOR:
+        {
+            struct line_alternator *alternator = skin_buffer_alloc(sizeof(struct line_alternator));
+            alternator->current_line = 0;
+            alternator->last_change_tick = current_tick;
+            element->data = alternator;
+        }
+        break;
+        case CONDITIONAL:
+        {
+            struct conditional *conditional = skin_buffer_alloc(sizeof(struct conditional));
+            conditional->last_value = -1;
+            conditional->token = element->data;
+            element->data = conditional;
+            const struct wps_tag *tag;
+            for (tag = all_tags;
+                 strncmp(element->tag->name, tag->name, strlen(tag->name)) != 0;
+                 tag++) ;
+            if (tag->type != SKIN_TOKEN_NO_TOKEN)
+            {
+                if (!check_feature_tag(tag->type))
+                {
+                    return FEATURE_NOT_AVAILABLE;
+                }
+            }
+            return CALLBACK_OK;
+        }
+        case TEXT:
+            /* nothing to do, the string is already in data */
+        default:
+            break;
+    }
+    return CALLBACK_OK;
+}
 
 /* to setup up the wps-data from a format-buffer (isfile = false)
    from a (wps-)file (isfile = true)*/
@@ -2287,34 +1894,7 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
     skin_data_reset(wps_data);
     wps_data->wps_loaded = false;
     curr_screen = screen;
-
-    /* alloc default viewport, will be fixed up later */
-    curr_vp = skin_buffer_alloc(sizeof(struct skin_viewport));
-    if (!curr_vp)
-        return false;
-    struct skin_token_list *list = new_skin_token_list_item(NULL, curr_vp);
-    if (!list)
-        return false;
-    add_to_ll_chain(&wps_data->viewports, list);
-
-
-    /* Initialise the first (default) viewport */
-    curr_vp->label         = VP_DEFAULT_LABEL;
-    curr_vp->hidden_flags  = 0;
-    curr_vp->lines         = NULL;
-
-    viewport_set_defaults(&curr_vp->vp, screen);
-#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
-    curr_vp->start_fgcolour = curr_vp->vp.fg_pattern;
-    curr_vp->start_bgcolour = curr_vp->vp.bg_pattern;
-#endif
-#ifdef HAVE_LCD_BITMAP
-    curr_vp->vp.font = FONT_UI;
-#endif
-
     curr_line = NULL;
-    if (!skin_start_new_line(curr_vp, 0))
-        return false;
 
     if (isfile)
     {
@@ -2350,8 +1930,11 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
     {
         wps_buffer = (char*)buf;
     }
-    /* parse the WPS source */
-    if (!wps_parse(wps_data, wps_buffer, isfile)) {
+    
+    wps_data->backdrop = "-";
+    /* parse the skin source */
+    wps_data->tree = skin_parse(wps_buffer, skin_element_callback, wps_data);
+    if (!wps_data->tree) {
         skin_data_reset(wps_data);
         return false;
     }
@@ -2396,8 +1979,8 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
 #endif
     wps_data->wps_loaded = true;
 #ifdef DEBUG_SKIN_ENGINE
-    if (isfile && debug_wps)
-        debug_skin_usage();
+ //   if (isfile && debug_wps)
+ //       debug_skin_usage();
 #endif
     return true;
 }
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c
new file mode 100644
index 0000000..fba95e8
--- /dev/null
+++ b/apps/gui/skin_engine/skin_render.c
@@ -0,0 +1,480 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id: skin_parser.c 26752 2010-06-10 21:22:16Z bieber $
+ *
+ * Copyright (C) 2010 Jonathan Gordon
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+#include <ctype.h>
+#include "strlcat.h"
+
+#include "config.h"
+#include "kernel.h"
+
+#include "skin_engine.h"
+#include "skin_parser.h"
+#include "tag_table.h"
+#include "skin_scan.h"
+#include "radio.h"
+
+
+#define MAX_LINE 1024
+
+struct skin_draw_info {
+    struct gui_wps *gwps;
+    struct skin_viewport *skin_vp;
+    int line_number;
+    unsigned long refresh_type;
+    
+    char* cur_align_start;
+    struct align_pos align;
+    bool no_line_break;
+    bool line_scrolls;
+    
+    char *buf;
+    size_t buf_size;
+};
+
+typedef void (*skin_render_func)(struct skin_element* alternator, struct skin_draw_info *info);
+void skin_render_alternator(struct skin_element* alternator, struct skin_draw_info *info);
+
+void wps_display_images(struct gui_wps *gwps, struct viewport* vp);
+int evaluate_conditional(struct gui_wps *gwps, struct conditional *conditional, int num_options);
+void draw_progressbar(struct gui_wps *gwps, struct progressbar *pb);
+void clear_image_pos(struct gui_wps *gwps, struct gui_img *img);
+void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subimage);
+
+static bool do_non_text_tags(struct gui_wps *gwps, struct wps_token *token, struct viewport* vp)
+{
+    struct wps_data *data = gwps->data;
+    struct screen *display = gwps->display;
+    switch (token->type)
+    {   
+#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
+        case SKIN_TOKEN_VIEWPORT_FGCOLOUR:
+        {
+            struct viewport_colour *col = token->value.data;
+            col->vp->fg_pattern = col->colour;
+        }
+        break;
+        case SKIN_TOKEN_VIEWPORT_BGCOLOUR:
+        {
+            struct viewport_colour *col = token->value.data;
+            col->vp->bg_pattern = col->colour;
+        }
+        break;
+#endif
+        case SKIN_TOKEN_VIEWPORT_ENABLE:
+        {
+            char label = token->value.i;
+            char temp = VP_DRAW_HIDEABLE;
+            struct skin_element *viewport = gwps->data->tree;
+            while (viewport)
+            {
+                struct skin_viewport *skinvp = (struct skin_viewport*)viewport->data;
+                if (skinvp->label == label)
+                {
+                    if (skinvp->hidden_flags&VP_DRAW_WASHIDDEN)
+                        temp |= VP_DRAW_WASHIDDEN;
+                    skinvp->hidden_flags = temp;
+                }
+                viewport = viewport->next;
+            }
+        }
+        break;
+#ifdef HAVE_LCD_BITMAP
+        case SKIN_TOKEN_UIVIEWPORT_ENABLE:
+            sb_set_info_vp(gwps->display->screen_type, 
+                           token->value.i|VP_INFO_LABEL);
+            break;
+        case SKIN_TOKEN_PEAKMETER:
+            data->peak_meter_enabled = true;
+            break;
+        case SKIN_TOKEN_VOLUMEBAR:
+        case SKIN_TOKEN_BATTERY_PERCENTBAR:
+        case SKIN_TOKEN_PROGRESSBAR:
+        {
+            struct progressbar *bar = (struct progressbar*)token->value.data;
+            draw_progressbar(gwps, bar);
+        }
+        break;
+        case SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY:
+        {
+            char n = token->value.i & 0xFF;
+            int subimage = token->value.i >> 8;
+            struct gui_img *img = find_image(n, data);
+
+            if (img && img->loaded)
+            {
+                if (subimage >= 0)
+                {
+                    wps_draw_image(gwps, img, subimage);
+                }
+                else if (img->always_display && img->vp == vp)
+                {
+                    wps_draw_image(gwps, img, 0);
+                }
+            }
+            break;
+        }
+#ifdef HAVE_ALBUMART
+        case SKIN_TOKEN_ALBUMART_DISPLAY:
+            /* now draw the AA */
+            if (data->albumart)
+            {
+                int handle = playback_current_aa_hid(data->playback_aa_slot);
+#if CONFIG_TUNER
+                if (in_radio_screen() || (get_radio_status() != FMRADIO_OFF))
+                {
+                    struct dim dim = {data->albumart->width, data->albumart->height};
+                    handle = radio_get_art_hid(&dim);
+                }
+#endif
+                draw_album_art(gwps, handle, false);
+            }
+            break;
+#endif
+        case SKIN_TOKEN_DRAW_INBUILTBAR:
+            gui_statusbar_draw(&(statusbars.statusbars[gwps->display->screen_type]),
+                               /*info->refresh_mode == SKIN_REFRESH_ALL*/true,
+                               token->value.data);
+            break;
+        case SKIN_TOKEN_VIEWPORT_CUSTOMLIST:
+            draw_playlist_viewer_list(gwps, token->value.data);
+            break;
+        
+#endif /* HAVE_LCD_BITMAP */
+        default:
+            return false;
+    }
+    return true;
+}
+                
+
+
+static void do_tags_in_hidden_conditional(struct skin_element* branch, struct gui_wps *gwps)
+{
+    struct wps_data *data = gwps->data;
+    /* Tags here are ones which need to be "turned off" or cleared 
+     * if they are in a conditional branch which isnt being used */
+    if (branch->type == LINE_ALTERNATOR)
+    {
+        int i;
+        for (i=0; i<branch->children_count; i++)
+        {
+            do_tags_in_hidden_conditional(branch->children[i], gwps);
+        }
+    }
+    else if (branch->type == LINE && branch->children_count)
+    {
+        struct skin_element *child = branch->children[0];
+        struct wps_token *token;
+        while (child)
+        {
+            if (child->type != TAG || !child->data)
+            {
+                child = child->next;
+                continue;
+            }
+            token = (struct wps_token *)child->data;
+#ifdef HAVE_LCD_BITMAP
+            /* clear all pictures in the conditional and nested ones */
+            if (token->type == SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY)
+            {
+                clear_image_pos(gwps, find_image(token->value.i&0xFF, data));
+            }
+            else if (token->type == SKIN_TOKEN_VOLUMEBAR   ||
+                     token->type == SKIN_TOKEN_PROGRESSBAR ||
+                     token->type == SKIN_TOKEN_BATTERY_PERCENTBAR )
+            {
+                struct progressbar *bar = (struct progressbar*)token->value.data;
+                bar->draw = false;
+            }
+            else if (token->type == SKIN_TOKEN_PEAKMETER)
+            {
+                data->peak_meter_enabled = false;
+            }
+#endif
+#ifdef HAVE_ALBUMART
+            if (data->albumart && token->type == SKIN_TOKEN_ALBUMART_DISPLAY)
+            {
+                draw_album_art(gwps,
+                        playback_current_aa_hid(data->playback_aa_slot), true);
+            }
+#endif
+            child = child->next;
+        }
+    }
+}
+    
+static void fix_line_alignment(struct skin_draw_info *info, struct skin_element *element)
+{
+    struct align_pos *align = &info->align;
+    char *cur_pos = info->cur_align_start + strlen(info->cur_align_start);
+    switch (element->tag->type)
+    {
+        case SKIN_TOKEN_ALIGN_LEFT:
+            *cur_pos = '\0'; cur_pos++; *cur_pos = '\0';
+            align->left = cur_pos;
+            info->cur_align_start = cur_pos;
+            break;
+        case SKIN_TOKEN_ALIGN_LEFT_RTL:
+            *cur_pos = '\0'; cur_pos++; *cur_pos = '\0';
+            if (lang_is_rtl())
+                align->right = cur_pos;
+            else
+                align->left = cur_pos;
+            info->cur_align_start = cur_pos;
+            break;
+        case SKIN_TOKEN_ALIGN_CENTER:
+            *cur_pos = '\0'; cur_pos++; *cur_pos = '\0';
+            align->center = cur_pos;
+            info->cur_align_start = cur_pos;
+            break;
+        case SKIN_TOKEN_ALIGN_RIGHT:
+            *cur_pos = '\0'; cur_pos++; *cur_pos = '\0';
+            align->right = cur_pos;
+            info->cur_align_start = cur_pos;
+            break;
+        case SKIN_TOKEN_ALIGN_RIGHT_RTL:
+            *cur_pos = '\0'; cur_pos++; *cur_pos = '\0';
+            if (lang_is_rtl())
+                align->left = cur_pos;
+            else
+                align->right = cur_pos;
+            info->cur_align_start = cur_pos;
+            break;
+        default:
+            break;
+    }
+}
+    
+/* Draw a LINE element onto the display */
+void skin_render_line(struct skin_element* line, struct skin_draw_info *info)
+{
+    int last_value, value;
+    if (line->children_count == 0)
+        return; /* empty line, do nothing */
+    struct skin_element *child = line->children[0];
+    skin_render_func func = skin_render_line;
+    char tempbuf[128];
+    while (child)
+    {
+        tempbuf[0] = '\0';
+        switch (child->type)
+        {
+            case CONDITIONAL:
+                last_value = ((struct conditional*)(child->data))->last_value;
+                value = evaluate_conditional(info->gwps, (struct conditional*)child->data, child->children_count);
+             //   if (last_value != value)
+             //       printf("%s, %d %d\n", child->tag->name, last_value, value);
+                if (value >= child->children_count)
+                    value = child->children_count-1;
+                    
+                /* some tags need handling if they are being disabled.
+                 * %?aa<true> and %?<true|false> need special handlng here */
+                if (value == 0 && last_value == 1 && last_value == child->children_count)
+                {
+                    /* we are in a false branch of a %?aa<true> conditional */
+                    do_tags_in_hidden_conditional(child->children[0], info->gwps);
+                    break;
+                }
+                else if (last_value >= 0 && value != last_value && last_value < child->children_count)
+                    do_tags_in_hidden_conditional(child->children[last_value], info->gwps);
+                last_value = value;
+                
+                if (child->children[value]->type == LINE_ALTERNATOR)
+                    func = skin_render_alternator;
+                else if (child->children[value]->type == LINE)
+                    func = skin_render_line;
+                func(child->children[value], info);
+                break;
+            case TAG:
+                if (child->tag->flags & NOBREAK)
+                    info->no_line_break = true;
+                if (child->tag->type == SKIN_TOKEN_SUBLINE_SCROLL)
+                    info->line_scrolls = true;
+                
+                fix_line_alignment(info, child);
+                
+                if (!child->data)
+                {
+                    break;
+                }
+                if (!do_non_text_tags(info->gwps, child->data, &info->skin_vp->vp))
+                {
+                    const char *value = get_token_value(info->gwps, child->data,
+                                              tempbuf, sizeof(tempbuf), NULL);
+                    if (value)
+                    {
+                        strlcat(info->cur_align_start, value, 
+                                info->buf_size - (info->cur_align_start-info->buf));
+                        tempbuf[0] = '\0';
+                    }
+                }
+                break;
+            case TEXT:
+                strlcat(info->cur_align_start, child->data, 
+                        info->buf_size - (info->cur_align_start-info->buf));
+                break;
+            case COMMENT:
+            default:
+                break;
+        }
+
+        child = child->next;
+    }
+}
+
+void skin_render_alternator(struct skin_element* element, struct skin_draw_info *info)
+{
+    struct line_alternator *alternator = (struct line_alternator*)element->data;
+    if (info->refresh_type == SKIN_REFRESH_ALL)
+    {
+        alternator->current_line = 0;
+        alternator->last_change_tick = current_tick;
+    }
+    else
+    {
+        struct skin_element *current_line = element->children[alternator->current_line];
+        struct line *line = (struct line *)current_line->data;
+        int next_change = alternator->last_change_tick + line->timeout;
+        if (TIME_AFTER(current_tick, next_change))
+        {
+            alternator->current_line++;
+            if (alternator->current_line >= element->children_count)
+                alternator->current_line = 0;
+            alternator->last_change_tick = current_tick;
+        }
+    }
+    skin_render_line(element->children[alternator->current_line], info);
+}
+
+void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
+                          struct skin_viewport* skin_viewport, unsigned long refresh_type)
+{
+    struct wps_data *data = gwps->data;
+    struct screen *display = gwps->display;
+    char linebuf[MAX_LINE];
+    skin_render_func func = skin_render_line;
+    struct skin_element* line = viewport;
+    struct skin_draw_info info = {
+        .gwps = gwps,
+        .buf = linebuf,
+        .buf_size = sizeof(linebuf),
+        .line_number = 0,
+        .no_line_break = false,
+        .line_scrolls = false,
+        .refresh_type = refresh_type,
+        .skin_vp = skin_viewport
+    };
+    
+    struct align_pos * align = &info.align;
+    
+    while (line)
+    {
+        linebuf[0] = '\0';
+        info.no_line_break = false;
+        info.line_scrolls = false;
+    
+        info.cur_align_start = info.buf;
+        align->left = info.buf;
+        align->center = NULL;
+        align->right = NULL;
+        
+        
+        if (line->type == LINE_ALTERNATOR)
+            func = skin_render_alternator;
+        else if (line->type == LINE)
+            func = skin_render_line;
+        
+        func(line, &info);
+        
+        if (refresh_type)
+        {
+            write_line(display, align, info.line_number, info.line_scrolls);
+        }
+        if (!info.no_line_break)
+            info.line_number++;
+        line = line->next;
+    }
+}
+
+void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
+{
+    struct wps_data *data = gwps->data;
+    struct screen *display = gwps->display;
+    
+    struct skin_element* viewport = data->tree;
+    struct skin_viewport* skin_viewport;
+    
+    int old_refresh_mode = refresh_mode;
+    
+    refresh_mode = viewport->next? 0 : old_refresh_mode;
+    
+    for (viewport = data->tree;
+         viewport;
+         viewport = viewport->next)
+    {
+        /* SETUP */
+        skin_viewport = (struct skin_viewport*)viewport->data;
+        unsigned vp_refresh_mode = refresh_mode;
+#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
+        skin_viewport->vp.fg_pattern = skin_viewport->start_fgcolour;
+        skin_viewport->vp.bg_pattern = skin_viewport->start_bgcolour;
+#endif
+        display->set_viewport(&skin_viewport->vp);
+        
+        /* dont redraw the viewport if its disabled */
+        if (skin_viewport->hidden_flags&VP_NEVER_VISIBLE)
+        {   /* don't draw anything into this one */
+            vp_refresh_mode = 0;
+        }
+        else if ((skin_viewport->hidden_flags&VP_DRAW_HIDDEN))
+        {
+            if (!(skin_viewport->hidden_flags&VP_DRAW_WASHIDDEN))
+                display->scroll_stop(&skin_viewport->vp);
+            skin_viewport->hidden_flags |= VP_DRAW_WASHIDDEN;
+            continue;
+        }
+        else if (((skin_viewport->hidden_flags&
+                   (VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE))
+                    == (VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE)))
+        {
+            vp_refresh_mode = SKIN_REFRESH_ALL;
+            skin_viewport->hidden_flags = VP_DRAW_HIDEABLE;
+        }
+
+        if (vp_refresh_mode == SKIN_REFRESH_ALL)
+        {
+            display->clear_viewport();
+        }
+        
+        /* render */
+        skin_render_viewport(viewport->children[0], gwps,
+                             skin_viewport, vp_refresh_mode);
+        refresh_mode = old_refresh_mode;
+    }
+    
+    /* Restore the default viewport */
+    display->set_viewport(NULL);
+    display->update();
+}
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index b0a55ca..408b89f 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -167,19 +167,19 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
         unsigned long elapsed = id3->elapsed + state->ff_rewind_count;
         switch (token->type)
         {
-            case WPS_TOKEN_METADATA_ARTIST:
+            case SKIN_TOKEN_METADATA_ARTIST:
                 return id3->artist;
-            case WPS_TOKEN_METADATA_COMPOSER:
+            case SKIN_TOKEN_METADATA_COMPOSER:
                 return id3->composer;
-            case WPS_TOKEN_METADATA_ALBUM:
+            case SKIN_TOKEN_METADATA_ALBUM:
                 return id3->album;
-            case WPS_TOKEN_METADATA_ALBUM_ARTIST:
+            case SKIN_TOKEN_METADATA_ALBUM_ARTIST:
                 return id3->albumartist;
-            case WPS_TOKEN_METADATA_GROUPING:
+            case SKIN_TOKEN_METADATA_GROUPING:
                 return id3->grouping;
-            case WPS_TOKEN_METADATA_GENRE:
+            case SKIN_TOKEN_METADATA_GENRE:
                 return id3->genre_string;
-            case WPS_TOKEN_METADATA_DISC_NUMBER:
+            case SKIN_TOKEN_METADATA_DISC_NUMBER:
                 if (id3->disc_string)
                     return id3->disc_string;
                 if (id3->discnum) {
@@ -187,7 +187,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
                     return buf;
                 }
                 return NULL;
-            case WPS_TOKEN_METADATA_TRACK_NUMBER:
+            case SKIN_TOKEN_METADATA_TRACK_NUMBER:
                 if (id3->track_string)
                     return id3->track_string;
                 if (id3->tracknum) {
@@ -195,9 +195,9 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
                     return buf;
                 }
                 return NULL;
-            case WPS_TOKEN_METADATA_TRACK_TITLE:
+            case SKIN_TOKEN_METADATA_TRACK_TITLE:
                 return id3->title;
-            case WPS_TOKEN_METADATA_VERSION:
+            case SKIN_TOKEN_METADATA_VERSION:
                 switch (id3->id3version)
                 {
                     case ID3_VER_1_0:
@@ -214,7 +214,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
                         break;
                 }
                 return NULL;
-            case WPS_TOKEN_METADATA_YEAR:
+            case SKIN_TOKEN_METADATA_YEAR:
                 if( id3->year_string )
                     return id3->year_string;
                 if (id3->year) {
@@ -222,29 +222,29 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
                     return buf;
                 }
                 return NULL;
-            case WPS_TOKEN_METADATA_COMMENT:
+            case SKIN_TOKEN_METADATA_COMMENT:
                 return id3->comment;
-            case WPS_TOKEN_FILE_PATH:
+            case SKIN_TOKEN_FILE_PATH:
                 return id3->path;
-            case WPS_TOKEN_FILE_BITRATE:
+            case SKIN_TOKEN_FILE_BITRATE:
                 if(id3->bitrate)
                     snprintf(buf, buf_size, "%d", id3->bitrate);
                 else
                     return "?";
                 return buf;
-            case WPS_TOKEN_TRACK_TIME_ELAPSED:
+            case SKIN_TOKEN_TRACK_TIME_ELAPSED:
                 format_time(buf, buf_size, elapsed);
                 return buf;
 
-            case WPS_TOKEN_TRACK_TIME_REMAINING:
+            case SKIN_TOKEN_TRACK_TIME_REMAINING:
                 format_time(buf, buf_size, length - elapsed);
                 return buf;
 
-            case WPS_TOKEN_TRACK_LENGTH:
+            case SKIN_TOKEN_TRACK_LENGTH:
                 format_time(buf, buf_size, length);
                 return buf;
 
-            case WPS_TOKEN_TRACK_ELAPSED_PERCENT:
+            case SKIN_TOKEN_TRACK_ELAPSED_PERCENT:
                 if (length <= 0)
                     return NULL;
 
@@ -255,14 +255,14 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
                 snprintf(buf, buf_size, "%lu", 100 * elapsed / length);
                 return buf;
 
-            case WPS_TOKEN_TRACK_STARTING:
+            case SKIN_TOKEN_TRACK_STARTING:
                 {
                     unsigned long time = token->value.i * 1000;
                     if (elapsed < time)
                         return "starting";
                 }
                 return NULL;
-            case WPS_TOKEN_TRACK_ENDING:
+            case SKIN_TOKEN_TRACK_ENDING:
                 {
                     unsigned long time = token->value.i * 1000;
                     if (length - elapsed < time)
@@ -270,7 +270,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
                 }
                 return NULL;
 
-            case WPS_TOKEN_FILE_CODEC:
+            case SKIN_TOKEN_FILE_CODEC:
                 if (intval)
                 {
                     if(id3->codectype == AFMT_UNKNOWN)
@@ -280,10 +280,10 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
                 }
                 return get_codectype(id3);
 
-            case WPS_TOKEN_FILE_FREQUENCY:
+            case SKIN_TOKEN_FILE_FREQUENCY:
                 snprintf(buf, buf_size, "%ld", id3->frequency);
                 return buf;
-            case WPS_TOKEN_FILE_FREQUENCY_KHZ:
+            case SKIN_TOKEN_FILE_FREQUENCY_KHZ:
                 /* ignore remainders < 100, so 22050 Hz becomes just 22k */
                 if ((id3->frequency % 1000) < 100)
                     snprintf(buf, buf_size, "%ld", id3->frequency / 1000);
@@ -292,7 +292,7 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
                             id3->frequency / 1000,
                             (id3->frequency % 1000) / 100);
                 return buf;
-            case WPS_TOKEN_FILE_NAME:
+            case SKIN_TOKEN_FILE_NAME:
                 if (get_dir(buf, buf_size, id3->path, 0)) {
                     /* Remove extension */
                     char* sep = strrchr(buf, '.');
@@ -302,28 +302,28 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
                     return buf;
                 }
                 return NULL;
-            case WPS_TOKEN_FILE_NAME_WITH_EXTENSION:
+            case SKIN_TOKEN_FILE_NAME_WITH_EXTENSION:
                 return get_dir(buf, buf_size, id3->path, 0);
-            case WPS_TOKEN_FILE_SIZE:
+            case SKIN_TOKEN_FILE_SIZE:
                 snprintf(buf, buf_size, "%ld", id3->filesize / 1024);
                 return buf;
-            case WPS_TOKEN_FILE_VBR:
+            case SKIN_TOKEN_FILE_VBR:
                 return (id3->vbr) ? "(avg)" : NULL;
-            case WPS_TOKEN_FILE_DIRECTORY:
+            case SKIN_TOKEN_FILE_DIRECTORY:
                 return get_dir(buf, buf_size, id3->path, token->value.i);
 
 #ifdef HAVE_TAGCACHE
-        case WPS_TOKEN_DATABASE_PLAYCOUNT:
+        case SKIN_TOKEN_DATABASE_PLAYCOUNT:
             if (intval)
                 *intval = id3->playcount + 1;
             snprintf(buf, buf_size, "%ld", id3->playcount);
             return buf;
-        case WPS_TOKEN_DATABASE_RATING:
+        case SKIN_TOKEN_DATABASE_RATING:
             if (intval)
                 *intval = id3->rating + 1;
             snprintf(buf, buf_size, "%d", id3->rating);
             return buf;
-        case WPS_TOKEN_DATABASE_AUTOSCORE:
+        case SKIN_TOKEN_DATABASE_AUTOSCORE:
             if (intval)
                 *intval = id3->score + 1;
             snprintf(buf, buf_size, "%d", id3->score);
@@ -340,13 +340,13 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3,
         {
             /* Most tokens expect NULL on error so leave that for the default case,
              * The ones that expect "0" need to be handled */
-            case WPS_TOKEN_FILE_FREQUENCY:
-            case WPS_TOKEN_FILE_FREQUENCY_KHZ:
-            case WPS_TOKEN_FILE_SIZE:
+            case SKIN_TOKEN_FILE_FREQUENCY:
+            case SKIN_TOKEN_FILE_FREQUENCY_KHZ:
+            case SKIN_TOKEN_FILE_SIZE:
 #ifdef HAVE_TAGCACHE
-            case WPS_TOKEN_DATABASE_PLAYCOUNT:
-            case WPS_TOKEN_DATABASE_RATING:
-            case WPS_TOKEN_DATABASE_AUTOSCORE:
+            case SKIN_TOKEN_DATABASE_PLAYCOUNT:
+            case SKIN_TOKEN_DATABASE_RATING:
+            case SKIN_TOKEN_DATABASE_AUTOSCORE:
 #endif
                 if (intval)
                     *intval = 0;
@@ -397,30 +397,30 @@ const char *get_radio_token(struct wps_token *token, int preset_offset,
     switch (token->type)
     {
         /* Radio/tuner tokens */
-        case WPS_TOKEN_TUNER_TUNED:
+        case SKIN_TOKEN_TUNER_TUNED:
             if (tuner_get(RADIO_TUNED))
                 return "t";
             return NULL;
-        case WPS_TOKEN_TUNER_SCANMODE:
+        case SKIN_TOKEN_TUNER_SCANMODE:
             if (radio_scan_mode())
                 return "s";
             return NULL;
-        case WPS_TOKEN_TUNER_STEREO:
+        case SKIN_TOKEN_TUNER_STEREO:
             if (radio_is_stereo())
                 return "s";
             return NULL;
-        case WPS_TOKEN_TUNER_MINFREQ: /* changes based on "region" */
+        case SKIN_TOKEN_TUNER_MINFREQ: /* changes based on "region" */
             return format_freq_MHz(region_data->freq_min,
                             region_data->freq_step, buf, buf_size);
-        case WPS_TOKEN_TUNER_MAXFREQ: /* changes based on "region" */
+        case SKIN_TOKEN_TUNER_MAXFREQ: /* changes based on "region" */
             return format_freq_MHz(region_data->freq_max,
                             region_data->freq_step, buf, buf_size);
-        case WPS_TOKEN_TUNER_CURFREQ:
+        case SKIN_TOKEN_TUNER_CURFREQ:
             return format_freq_MHz(radio_current_frequency(),
                             region_data->freq_step, buf, buf_size);
-        case WPS_TOKEN_PRESET_NAME:
-        case WPS_TOKEN_PRESET_FREQ:
-        case WPS_TOKEN_PRESET_ID:
+        case SKIN_TOKEN_PRESET_NAME:
+        case SKIN_TOKEN_PRESET_FREQ:
+        case SKIN_TOKEN_PRESET_ID:
         {
             int preset_count = radio_preset_count();
             int cur_preset = radio_current_preset();
@@ -431,29 +431,29 @@ const char *get_radio_token(struct wps_token *token, int preset_offset,
             preset %= preset_count;
             if (preset < 0)
                 preset += preset_count;
-            if (token->type == WPS_TOKEN_PRESET_NAME)
+            if (token->type == SKIN_TOKEN_PRESET_NAME)
                 snprintf(buf, buf_size, "%s", radio_get_preset(preset)->name);
-            else if (token->type == WPS_TOKEN_PRESET_FREQ)
+            else if (token->type == SKIN_TOKEN_PRESET_FREQ)
                 format_freq_MHz(radio_get_preset(preset)->frequency,
                                 region_data->freq_step, buf, buf_size);
             else
                 snprintf(buf, buf_size, "%d", preset + 1);
             return buf;
         }
-        case WPS_TOKEN_PRESET_COUNT:
+        case SKIN_TOKEN_PRESET_COUNT:
             snprintf(buf, buf_size, "%d", radio_preset_count());        
             if (intval)
                 *intval = radio_preset_count();
             return buf;
-        case WPS_TOKEN_HAVE_RDS:
+        case SKIN_TOKEN_HAVE_RDS:
 #ifdef HAVE_RDS_CAP
             return "rds";
-        case WPS_TOKEN_RDS_NAME:
+        case SKIN_TOKEN_RDS_NAME:
             return tuner_get_rds_info(RADIO_RDS_NAME);
-        case WPS_TOKEN_RDS_TEXT:
+        case SKIN_TOKEN_RDS_TEXT:
             return tuner_get_rds_info(RADIO_RDS_TEXT);
 #else
-            return NULL; /* end of the WPS_TOKEN_HAVE_RDS case */
+            return NULL; /* end of the SKIN_TOKEN_HAVE_RDS case */
 #endif /* HAVE_RDS_CAP */
     }
     return NULL;
@@ -497,8 +497,8 @@ const char *get_token_value(struct gui_wps *gwps,
 
     /* if the token is an RTC one, update the time
        and do the necessary checks */
-    if (token->type >= WPS_TOKENS_RTC_BEGIN
-        && token->type <= WPS_TOKENS_RTC_END)
+    if (token->type >= SKIN_TOKENS_RTC_BEGIN
+        && token->type <= SKIN_TOKENS_RTC_END)
     {
         tm = get_time();
 
@@ -531,44 +531,44 @@ const char *get_token_value(struct gui_wps *gwps,
 
     switch (token->type)
     {
-        case WPS_TOKEN_CHARACTER:
+        case SKIN_TOKEN_CHARACTER:
             if (token->value.c == '\n')
                 return NULL;
             return &(token->value.c);
 
-        case WPS_TOKEN_STRING:
+        case SKIN_TOKEN_STRING:
             return (char*)token->value.data;
             
-        case WPS_TOKEN_TRANSLATEDSTRING:
+        case SKIN_TOKEN_TRANSLATEDSTRING:
             return (char*)P2STR(ID2P(token->value.i));
 
-        case WPS_TOKEN_PLAYLIST_ENTRIES:
+        case SKIN_TOKEN_PLAYLIST_ENTRIES:
             snprintf(buf, buf_size, "%d", playlist_amount());
             return buf;
         
-        case WPS_TOKEN_LIST_TITLE_TEXT:
+        case SKIN_TOKEN_LIST_TITLE_TEXT:
             return (char*)token->value.data;
-        case WPS_TOKEN_LIST_TITLE_ICON:
+        case SKIN_TOKEN_LIST_TITLE_ICON:
             if (intval)
                 *intval = token->value.i;
             snprintf(buf, buf_size, "%d", token->value.i);
             return buf;
 
-        case WPS_TOKEN_PLAYLIST_NAME:
+        case SKIN_TOKEN_PLAYLIST_NAME:
             return playlist_name(NULL, buf, buf_size);
 
-        case WPS_TOKEN_PLAYLIST_POSITION:
+        case SKIN_TOKEN_PLAYLIST_POSITION:
             snprintf(buf, buf_size, "%d", playlist_get_display_index());
             return buf;
 
-        case WPS_TOKEN_PLAYLIST_SHUFFLE:
+        case SKIN_TOKEN_PLAYLIST_SHUFFLE:
             if ( global_settings.playlist_shuffle )
                 return "s";
             else
                 return NULL;
             break;
 
-        case WPS_TOKEN_VOLUME:
+        case SKIN_TOKEN_VOLUME:
             snprintf(buf, buf_size, "%d", global_settings.volume);
             if (intval)
             {
@@ -593,7 +593,7 @@ const char *get_token_value(struct gui_wps *gwps,
             }
             return buf;
 #ifdef HAVE_ALBUMART
-        case WPS_TOKEN_ALBUMART_FOUND:
+        case SKIN_TOKEN_ALBUMART_FOUND:
             if (data->albumart)
             {
                 int handle = -1;
@@ -609,16 +609,9 @@ const char *get_token_value(struct gui_wps *gwps,
                     return "C";
             }
             return NULL;
-            
-        case WPS_TOKEN_ALBUMART_DISPLAY:
-            if (!data->albumart)
-                return NULL;
-            if (!data->albumart->draw)
-                data->albumart->draw = true;
-            return NULL;
 #endif
 
-        case WPS_TOKEN_BATTERY_PERCENT:
+        case SKIN_TOKEN_BATTERY_PERCENT:
         {
             int l = battery_level();
 
@@ -641,14 +634,14 @@ const char *get_token_value(struct gui_wps *gwps,
             }
         }
 
-        case WPS_TOKEN_BATTERY_VOLTS:
+        case SKIN_TOKEN_BATTERY_VOLTS:
         {
             unsigned int v = battery_voltage();
             snprintf(buf, buf_size, "%d.%02d", v / 1000, (v % 1000) / 10);
             return buf;
         }
 
-        case WPS_TOKEN_BATTERY_TIME:
+        case SKIN_TOKEN_BATTERY_TIME:
         {
             int t = battery_time();
             if (t >= 0)
@@ -659,7 +652,7 @@ const char *get_token_value(struct gui_wps *gwps,
         }
 
 #if CONFIG_CHARGING
-        case WPS_TOKEN_BATTERY_CHARGER_CONNECTED:
+        case SKIN_TOKEN_BATTERY_CHARGER_CONNECTED:
         {
             if(charger_input_state==CHARGER)
                 return "p";
@@ -668,7 +661,7 @@ const char *get_token_value(struct gui_wps *gwps,
         }
 #endif
 #if CONFIG_CHARGING >= CHARGING_MONITOR
-        case WPS_TOKEN_BATTERY_CHARGING:
+        case SKIN_TOKEN_BATTERY_CHARGING:
         {
             if (charge_state == CHARGING || charge_state == TOPOFF) {
                 return "c";
@@ -678,12 +671,12 @@ const char *get_token_value(struct gui_wps *gwps,
         }
 #endif
 #ifdef HAVE_USB_POWER
-        case WPS_TOKEN_USB_POWERED:
+        case SKIN_TOKEN_USB_POWERED:
             if (usb_powered())
                 return "u";
             return NULL;
 #endif
-        case WPS_TOKEN_BATTERY_SLEEPTIME:
+        case SKIN_TOKEN_BATTERY_SLEEPTIME:
         {
             if (get_sleep_timer() == 0)
                 return NULL;
@@ -694,7 +687,7 @@ const char *get_token_value(struct gui_wps *gwps,
             }
         }
 
-        case WPS_TOKEN_PLAYBACK_STATUS:
+        case SKIN_TOKEN_PLAYBACK_STATUS:
         {
             int status = current_playmode();
             /* music */
@@ -734,13 +727,13 @@ const char *get_token_value(struct gui_wps *gwps,
             return buf;
         }
 
-        case WPS_TOKEN_REPEAT_MODE:
+        case SKIN_TOKEN_REPEAT_MODE:
             if (intval)
                 *intval = global_settings.repeat_mode + 1;
             snprintf(buf, buf_size, "%d", global_settings.repeat_mode);
             return buf;
 
-        case WPS_TOKEN_RTC_PRESENT:
+        case SKIN_TOKEN_RTC_PRESENT:
 #if CONFIG_RTC
                 return "c";
 #else
@@ -748,41 +741,41 @@ const char *get_token_value(struct gui_wps *gwps,
 #endif
 
 #if CONFIG_RTC
-        case WPS_TOKEN_RTC_12HOUR_CFG:
+        case SKIN_TOKEN_RTC_12HOUR_CFG:
             if (intval)
                 *intval = global_settings.timeformat + 1;
             snprintf(buf, buf_size, "%d", global_settings.timeformat);
             return buf;
 
-        case WPS_TOKEN_RTC_DAY_OF_MONTH:
+        case SKIN_TOKEN_RTC_DAY_OF_MONTH:
             /* d: day of month (01..31) */
             snprintf(buf, buf_size, "%02d", tm->tm_mday);
             if (intval)
                 *intval = tm->tm_mday - 1;
             return buf;
 
-        case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED:
+        case SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED:
             /* e: day of month, blank padded ( 1..31) */
             snprintf(buf, buf_size, "%2d", tm->tm_mday);
             if (intval)
                 *intval = tm->tm_mday - 1;
             return buf;
 
-        case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED:
+        case SKIN_TOKEN_RTC_HOUR_24_ZERO_PADDED:
             /* H: hour (00..23) */
             snprintf(buf, buf_size, "%02d", tm->tm_hour);
             if (intval)
                 *intval = tm->tm_hour;
             return buf;
 
-        case WPS_TOKEN_RTC_HOUR_24:
+        case SKIN_TOKEN_RTC_HOUR_24:
             /* k: hour ( 0..23) */
             snprintf(buf, buf_size, "%2d", tm->tm_hour);
             if (intval)
                 *intval = tm->tm_hour;
             return buf;
 
-        case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED:
+        case SKIN_TOKEN_RTC_HOUR_12_ZERO_PADDED:
             /* I: hour (01..12) */
             snprintf(buf, buf_size, "%02d",
                      (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12);
@@ -790,7 +783,7 @@ const char *get_token_value(struct gui_wps *gwps,
                 *intval = (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12;
             return buf;
 
-        case WPS_TOKEN_RTC_HOUR_12:
+        case SKIN_TOKEN_RTC_HOUR_12:
             /* l: hour ( 1..12) */
             snprintf(buf, buf_size, "%2d",
                      (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12);
@@ -798,107 +791,107 @@ const char *get_token_value(struct gui_wps *gwps,
                 *intval = (tm->tm_hour % 12 == 0) ? 12 : tm->tm_hour % 12;
             return buf;
 
-        case WPS_TOKEN_RTC_MONTH:
+        case SKIN_TOKEN_RTC_MONTH:
             /* m: month (01..12) */
             if (intval)
                 *intval = tm->tm_mon + 1;
             snprintf(buf, buf_size, "%02d", tm->tm_mon + 1);
             return buf;
 
-        case WPS_TOKEN_RTC_MINUTE:
+        case SKIN_TOKEN_RTC_MINUTE:
             /* M: minute (00..59) */
             snprintf(buf, buf_size, "%02d", tm->tm_min);
             if (intval)
                 *intval = tm->tm_min;
             return buf;
 
-        case WPS_TOKEN_RTC_SECOND:
+        case SKIN_TOKEN_RTC_SECOND:
             /* S: second (00..59) */
             snprintf(buf, buf_size, "%02d", tm->tm_sec);
             if (intval)
                 *intval = tm->tm_sec;
             return buf;
 
-        case WPS_TOKEN_RTC_YEAR_2_DIGITS:
+        case SKIN_TOKEN_RTC_YEAR_2_DIGITS:
             /* y: last two digits of year (00..99) */
             snprintf(buf, buf_size, "%02d", tm->tm_year % 100);
             if (intval)
                 *intval = tm->tm_year % 100;
             return buf;
 
-        case WPS_TOKEN_RTC_YEAR_4_DIGITS:
+        case SKIN_TOKEN_RTC_YEAR_4_DIGITS:
             /* Y: year (1970...) */
             snprintf(buf, buf_size, "%04d", tm->tm_year + 1900);
             if (intval)
                 *intval = tm->tm_year + 1900;
             return buf;
 
-        case WPS_TOKEN_RTC_AM_PM_UPPER:
+        case SKIN_TOKEN_RTC_AM_PM_UPPER:
             /* p: upper case AM or PM indicator */
             if (intval)
                 *intval = tm->tm_hour/12 == 0 ? 0 : 1;
             return tm->tm_hour/12 == 0 ? "AM" : "PM";
 
-        case WPS_TOKEN_RTC_AM_PM_LOWER:
+        case SKIN_TOKEN_RTC_AM_PM_LOWER:
             /* P: lower case am or pm indicator */
             if (intval)
                 *intval = tm->tm_hour/12 == 0 ? 0 : 1;
             return tm->tm_hour/12 == 0 ? "am" : "pm";
 
-        case WPS_TOKEN_RTC_WEEKDAY_NAME:
+        case SKIN_TOKEN_RTC_WEEKDAY_NAME:
             /* a: abbreviated weekday name (Sun..Sat) */
             return str(LANG_WEEKDAY_SUNDAY + tm->tm_wday);
 
-        case WPS_TOKEN_RTC_MONTH_NAME:
+        case SKIN_TOKEN_RTC_MONTH_NAME:
             /* b: abbreviated month name (Jan..Dec) */
             return str(LANG_MONTH_JANUARY + tm->tm_mon);
 
-        case WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON:
+        case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_MON:
             /* u: day of week (1..7); 1 is Monday */
             if (intval)
                 *intval = (tm->tm_wday == 0) ? 7 : tm->tm_wday;
             snprintf(buf, buf_size, "%1d", tm->tm_wday + 1);
             return buf;
 
-        case WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN:
+        case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_SUN:
             /* w: day of week (0..6); 0 is Sunday */
             if (intval)
                 *intval = tm->tm_wday + 1;
             snprintf(buf, buf_size, "%1d", tm->tm_wday);
             return buf;
 #else
-        case WPS_TOKEN_RTC_DAY_OF_MONTH:
-        case WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED:
-        case WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED:
-        case WPS_TOKEN_RTC_HOUR_24:
-        case WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED:
-        case WPS_TOKEN_RTC_HOUR_12:
-        case WPS_TOKEN_RTC_MONTH:
-        case WPS_TOKEN_RTC_MINUTE:
-        case WPS_TOKEN_RTC_SECOND:
-        case WPS_TOKEN_RTC_AM_PM_UPPER:
-        case WPS_TOKEN_RTC_AM_PM_LOWER:
-        case WPS_TOKEN_RTC_YEAR_2_DIGITS:
+        case SKIN_TOKEN_RTC_DAY_OF_MONTH:
+        case SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED:
+        case SKIN_TOKEN_RTC_HOUR_24_ZERO_PADDED:
+        case SKIN_TOKEN_RTC_HOUR_24:
+        case SKIN_TOKEN_RTC_HOUR_12_ZERO_PADDED:
+        case SKIN_TOKEN_RTC_HOUR_12:
+        case SKIN_TOKEN_RTC_MONTH:
+        case SKIN_TOKEN_RTC_MINUTE:
+        case SKIN_TOKEN_RTC_SECOND:
+        case SKIN_TOKEN_RTC_AM_PM_UPPER:
+        case SKIN_TOKEN_RTC_AM_PM_LOWER:
+        case SKIN_TOKEN_RTC_YEAR_2_DIGITS:
             return "--";
-        case WPS_TOKEN_RTC_YEAR_4_DIGITS:
+        case SKIN_TOKEN_RTC_YEAR_4_DIGITS:
             return "----";
-        case WPS_TOKEN_RTC_WEEKDAY_NAME:
-        case WPS_TOKEN_RTC_MONTH_NAME:
+        case SKIN_TOKEN_RTC_WEEKDAY_NAME:
+        case SKIN_TOKEN_RTC_MONTH_NAME:
             return "---";
-        case WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON:
-        case WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN:
+        case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_MON:
+        case SKIN_TOKEN_RTC_DAY_OF_WEEK_START_SUN:
             return "-";
 #endif
 
 #ifdef HAVE_LCD_CHARCELLS
-        case WPS_TOKEN_PROGRESSBAR:
+        case SKIN_TOKEN_PROGRESSBAR:
         {
             char *end = utf8encode(data->wps_progress_pat[0], buf);
             *end = '\0';
             return buf;
         }
 
-        case WPS_TOKEN_PLAYER_PROGRESSBAR:
+        case SKIN_TOKEN_PLAYER_PROGRESSBAR:
             if(is_new_player())
             {
                 /* we need 11 characters (full line) for
@@ -916,7 +909,7 @@ const char *get_token_value(struct gui_wps *gwps,
 
 
 #if (CONFIG_CODEC == SWCODEC)
-        case WPS_TOKEN_CROSSFADE:
+        case SKIN_TOKEN_CROSSFADE:
 #ifdef HAVE_CROSSFADE
             if (intval)
                 *intval = global_settings.crossfade + 1;
@@ -926,7 +919,7 @@ const char *get_token_value(struct gui_wps *gwps,
 #endif
             return buf;
 
-        case WPS_TOKEN_REPLAYGAIN:
+        case SKIN_TOKEN_REPLAYGAIN:
         {
             int val;
 
@@ -974,7 +967,7 @@ const char *get_token_value(struct gui_wps *gwps,
 #endif  /* (CONFIG_CODEC == SWCODEC) */
 
 #if (CONFIG_CODEC != MAS3507D)
-        case WPS_TOKEN_SOUND_PITCH:
+        case SKIN_TOKEN_SOUND_PITCH:
         {
             int32_t pitch = sound_get_pitch();
             snprintf(buf, buf_size, "%ld.%ld",
@@ -989,7 +982,7 @@ const char *get_token_value(struct gui_wps *gwps,
 #endif
 
 #if CONFIG_CODEC == SWCODEC
-    case WPS_TOKEN_SOUND_SPEED:
+    case SKIN_TOKEN_SOUND_SPEED:
     {
         int32_t pitch = sound_get_pitch();
         int32_t speed;
@@ -1007,7 +1000,7 @@ const char *get_token_value(struct gui_wps *gwps,
     }
 #endif
 
-        case WPS_TOKEN_MAIN_HOLD:
+        case SKIN_TOKEN_MAIN_HOLD:
 #ifdef HAS_BUTTON_HOLD
             if (button_hold())
 #else
@@ -1018,7 +1011,7 @@ const char *get_token_value(struct gui_wps *gwps,
                 return NULL;
 
 #ifdef HAS_REMOTE_BUTTON_HOLD
-        case WPS_TOKEN_REMOTE_HOLD:
+        case SKIN_TOKEN_REMOTE_HOLD:
             if (remote_button_hold())
                 return "r";
             else
@@ -1026,20 +1019,20 @@ const char *get_token_value(struct gui_wps *gwps,
 #endif
 
 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
-        case WPS_TOKEN_VLED_HDD:
+        case SKIN_TOKEN_VLED_HDD:
             if(led_read(HZ/2))
                 return "h";
             else
                 return NULL;
 #endif
-        case WPS_TOKEN_BUTTON_VOLUME:
+        case SKIN_TOKEN_BUTTON_VOLUME:
             if (global_status.last_volume_change &&
                 TIME_BEFORE(current_tick, global_status.last_volume_change +
                                           token->value.i * TIMEOUT_UNIT))
                 return "v";
             return NULL;
             
-        case WPS_TOKEN_LASTTOUCH:
+        case SKIN_TOKEN_LASTTOUCH:
             {
 #ifdef HAVE_TOUCHSCREEN
             unsigned int last_touch = touchscreen_last_touch();
@@ -1051,7 +1044,7 @@ const char *get_token_value(struct gui_wps *gwps,
             }
             return NULL;
 
-        case WPS_TOKEN_SETTING:
+        case SKIN_TOKEN_SETTING:
         {
             const struct settings_list *s = settings+token->value.i;
             if (intval)
@@ -1120,14 +1113,14 @@ const char *get_token_value(struct gui_wps *gwps,
             cfg_to_string(token->value.i,buf,buf_size);
             return buf;
         }
-        case WPS_TOKEN_HAVE_TUNER:
+        case SKIN_TOKEN_HAVE_TUNER:
 #if CONFIG_TUNER
             if (radio_hardware_present())
                 return "r";
 #endif
             return NULL;
         /* Recording tokens */
-        case WPS_TOKEN_HAVE_RECORDING:
+        case SKIN_TOKEN_HAVE_RECORDING:
 #ifdef HAVE_RECORDING
             return "r";
 #else
@@ -1135,11 +1128,11 @@ const char *get_token_value(struct gui_wps *gwps,
 #endif
 
 #ifdef HAVE_RECORDING
-        case WPS_TOKEN_IS_RECORDING:
+        case SKIN_TOKEN_IS_RECORDING:
             if (audio_status() == AUDIO_STATUS_RECORD)
                 return "r";
             return NULL;
-        case WPS_TOKEN_REC_FREQ: /* order from REC_FREQ_CFG_VAL_LIST */
+        case SKIN_TOKEN_REC_FREQ: /* order from REC_FREQ_CFG_VAL_LIST */
         {
 #if CONFIG_CODEC == SWCODEC
             unsigned long samprk;
@@ -1227,7 +1220,7 @@ const char *get_token_value(struct gui_wps *gwps,
             return buf;
         }
 #if CONFIG_CODEC == SWCODEC
-        case WPS_TOKEN_REC_ENCODER:
+        case SKIN_TOKEN_REC_ENCODER:
         {
             int rec_format = global_settings.rec_format+1; /* WAV, AIFF, WV, MPEG */
             if (intval)
@@ -1248,7 +1241,7 @@ const char *get_token_value(struct gui_wps *gwps,
             break;
         }
 #endif
-        case WPS_TOKEN_REC_BITRATE:
+        case SKIN_TOKEN_REC_BITRATE:
 #if CONFIG_CODEC == SWCODEC
             if (global_settings.rec_format == REC_FORMAT_MPA_L3)
             {
@@ -1317,12 +1310,12 @@ const char *get_token_value(struct gui_wps *gwps,
             snprintf(buf, buf_size, "%d", global_settings.rec_quality);
             return buf;
 #endif
-        case WPS_TOKEN_REC_MONO:
+        case SKIN_TOKEN_REC_MONO:
             if (!global_settings.rec_channels)
                 return "m";
             return NULL;
             
-        case WPS_TOKEN_REC_SECONDS:
+        case SKIN_TOKEN_REC_SECONDS:
         {
             int time = (audio_recorded_time() / HZ) % 60;
             if (intval)
@@ -1330,7 +1323,7 @@ const char *get_token_value(struct gui_wps *gwps,
             snprintf(buf, buf_size, "%02d", time);
             return buf;
         }
-        case WPS_TOKEN_REC_MINUTES:
+        case SKIN_TOKEN_REC_MINUTES:
         {
             int time = (audio_recorded_time() / HZ) / 60;
             if (intval)
@@ -1338,7 +1331,7 @@ const char *get_token_value(struct gui_wps *gwps,
             snprintf(buf, buf_size, "%02d", time);
             return buf;
         }
-        case WPS_TOKEN_REC_HOURS:
+        case SKIN_TOKEN_REC_HOURS:
         {
             int time = (audio_recorded_time() / HZ) / 3600;
             if (intval)
@@ -1349,7 +1342,7 @@ const char *get_token_value(struct gui_wps *gwps,
 
 #endif /* HAVE_RECORDING */
 
-        case WPS_TOKEN_CURRENT_SCREEN:
+        case SKIN_TOKEN_CURRENT_SCREEN:
         {
             int curr_screen = current_screen();
 
@@ -1390,7 +1383,7 @@ const char *get_token_value(struct gui_wps *gwps,
             return buf;
         }
 
-        case WPS_TOKEN_LANG_IS_RTL:
+        case SKIN_TOKEN_LANG_IS_RTL:
             return lang_is_rtl() ? "r" : NULL;
 
         default:
diff --git a/apps/gui/skin_engine/skin_tokens.h b/apps/gui/skin_engine/skin_tokens.h
index 4731131..d518290 100644
--- a/apps/gui/skin_engine/skin_tokens.h
+++ b/apps/gui/skin_engine/skin_tokens.h
@@ -24,239 +24,6 @@
 
 #include <stdbool.h>
 
-
-enum wps_token_type {
-    
-  TOKEN_MARKER_CONTROL_TOKENS = -1,
-    WPS_NO_TOKEN = 0,   /* for WPS tags we don't want to save as tokens */
-    WPS_TOKEN_UNKNOWN,
-
-    /* Markers */
-    WPS_TOKEN_CHARACTER,
-    WPS_TOKEN_STRING,
-    WPS_TOKEN_TRANSLATEDSTRING,
-
-    /* Alignment */
-    WPS_TOKEN_ALIGN_LEFT,
-    WPS_TOKEN_ALIGN_LEFT_RTL,
-    WPS_TOKEN_ALIGN_CENTER,
-    WPS_TOKEN_ALIGN_RIGHT,
-    WPS_TOKEN_ALIGN_RIGHT_RTL,
-
-    /* Sublines */
-    WPS_TOKEN_SUBLINE_TIMEOUT,
-    
-    /* Conditional */
-    WPS_TOKEN_CONDITIONAL,
-    WPS_TOKEN_CONDITIONAL_START,
-    WPS_TOKEN_CONDITIONAL_OPTION,
-    WPS_TOKEN_CONDITIONAL_END,
-
-    /* Viewport display */
-    WPS_VIEWPORT_ENABLE,
-    WPS_VIEWPORT_CUSTOMLIST,
-    WPS_TOKEN_UIVIEWPORT_ENABLE,
-    WPS_TOKEN_VIEWPORT_FGCOLOUR,
-    WPS_TOKEN_VIEWPORT_BGCOLOUR,
-    
-    /* Battery */
-  TOKEN_MARKER_BATTERY,
-    WPS_TOKEN_BATTERY_PERCENT,
-    WPS_TOKEN_BATTERY_PERCENTBAR,
-    WPS_TOKEN_BATTERY_VOLTS,
-    WPS_TOKEN_BATTERY_TIME,
-    WPS_TOKEN_BATTERY_CHARGER_CONNECTED,
-    WPS_TOKEN_BATTERY_CHARGING,
-    WPS_TOKEN_BATTERY_SLEEPTIME,
-    WPS_TOKEN_USB_POWERED,
-
-    /* Sound */
-  TOKEN_MARKER_SOUND,
-#if (CONFIG_CODEC != MAS3507D)
-    WPS_TOKEN_SOUND_PITCH,
-#endif
-#if (CONFIG_CODEC == SWCODEC)
-    WPS_TOKEN_SOUND_SPEED,
-    WPS_TOKEN_REPLAYGAIN,
-    WPS_TOKEN_CROSSFADE,
-#endif
-
-    /* Time */
-  TOKEN_MARKER_RTC,
-    WPS_TOKEN_RTC_PRESENT,
-
-    /* The begin/end values allow us to know if a token is an RTC one.
-       New RTC tokens should be added between the markers. */
-
-    WPS_TOKENS_RTC_BEGIN, /* just the start marker, not an actual token */
-
-    WPS_TOKEN_RTC_DAY_OF_MONTH,
-    WPS_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED,
-    WPS_TOKEN_RTC_12HOUR_CFG,
-    WPS_TOKEN_RTC_HOUR_24_ZERO_PADDED,
-    WPS_TOKEN_RTC_HOUR_24,
-    WPS_TOKEN_RTC_HOUR_12_ZERO_PADDED,
-    WPS_TOKEN_RTC_HOUR_12,
-    WPS_TOKEN_RTC_MONTH,
-    WPS_TOKEN_RTC_MINUTE,
-    WPS_TOKEN_RTC_SECOND,
-    WPS_TOKEN_RTC_YEAR_2_DIGITS,
-    WPS_TOKEN_RTC_YEAR_4_DIGITS,
-    WPS_TOKEN_RTC_AM_PM_UPPER,
-    WPS_TOKEN_RTC_AM_PM_LOWER,
-    WPS_TOKEN_RTC_WEEKDAY_NAME,
-    WPS_TOKEN_RTC_MONTH_NAME,
-    WPS_TOKEN_RTC_DAY_OF_WEEK_START_MON,
-    WPS_TOKEN_RTC_DAY_OF_WEEK_START_SUN,
-
-    WPS_TOKENS_RTC_END,     /* just the end marker, not an actual token */
-
-    /* Database */
-  TOKEN_MARKER_DATABASE,
-#ifdef HAVE_TAGCACHE
-    WPS_TOKEN_DATABASE_PLAYCOUNT,
-    WPS_TOKEN_DATABASE_RATING,
-    WPS_TOKEN_DATABASE_AUTOSCORE,
-#endif
-
-    /* File */
-  TOKEN_MARKER_FILE,
-    WPS_TOKEN_FILE_BITRATE,
-    WPS_TOKEN_FILE_CODEC,
-    WPS_TOKEN_FILE_FREQUENCY,
-    WPS_TOKEN_FILE_FREQUENCY_KHZ,
-    WPS_TOKEN_FILE_NAME,
-    WPS_TOKEN_FILE_NAME_WITH_EXTENSION,
-    WPS_TOKEN_FILE_PATH,
-    WPS_TOKEN_FILE_SIZE,
-    WPS_TOKEN_FILE_VBR,
-    WPS_TOKEN_FILE_DIRECTORY,
-
-    /* Image */
-  TOKEN_MARKER_IMAGES,
-#ifdef HAVE_LCD_BITMAP
-    WPS_TOKEN_IMAGE_BACKDROP,
-    WPS_TOKEN_IMAGE_PROGRESS_BAR,
-    WPS_TOKEN_IMAGE_PRELOAD,
-    WPS_TOKEN_IMAGE_PRELOAD_DISPLAY,
-    WPS_TOKEN_IMAGE_DISPLAY,
-#endif
-
-#ifdef HAVE_ALBUMART
-    /* Albumart */
-    WPS_TOKEN_ALBUMART_DISPLAY,
-    WPS_TOKEN_ALBUMART_FOUND,
-#endif
-
-    /* Metadata */
-  TOKEN_MARKER_METADATA,
-    WPS_TOKEN_METADATA_ARTIST,
-    WPS_TOKEN_METADATA_COMPOSER,
-    WPS_TOKEN_METADATA_ALBUM_ARTIST,
-    WPS_TOKEN_METADATA_GROUPING,
-    WPS_TOKEN_METADATA_ALBUM,
-    WPS_TOKEN_METADATA_GENRE,
-    WPS_TOKEN_METADATA_DISC_NUMBER,
-    WPS_TOKEN_METADATA_TRACK_NUMBER,
-    WPS_TOKEN_METADATA_TRACK_TITLE,
-    WPS_TOKEN_METADATA_VERSION,
-    WPS_TOKEN_METADATA_YEAR,
-    WPS_TOKEN_METADATA_COMMENT,
-
-  TOKEN_MARKER_PLAYBACK_INFO,
-    /* Mode */
-    WPS_TOKEN_REPEAT_MODE,
-    WPS_TOKEN_PLAYBACK_STATUS,
-    /* Progressbar */
-    WPS_TOKEN_PROGRESSBAR,
-#ifdef HAVE_LCD_CHARCELLS
-    WPS_TOKEN_PLAYER_PROGRESSBAR,
-#endif
-#ifdef HAVE_LCD_BITMAP
-    /* Peakmeter */
-    WPS_TOKEN_PEAKMETER,
-#endif
-
-    /* Current track */
-    WPS_TOKEN_TRACK_ELAPSED_PERCENT,
-    WPS_TOKEN_TRACK_TIME_ELAPSED,
-    WPS_TOKEN_TRACK_TIME_REMAINING,
-    WPS_TOKEN_TRACK_LENGTH,
-    WPS_TOKEN_TRACK_STARTING,
-    WPS_TOKEN_TRACK_ENDING,
-
-    /* Playlist */
-  TOKEN_MARKER_PLAYLIST,
-    WPS_TOKEN_PLAYLIST_ENTRIES,
-    WPS_TOKEN_PLAYLIST_NAME,
-    WPS_TOKEN_PLAYLIST_POSITION,
-    WPS_TOKEN_PLAYLIST_SHUFFLE,
-
-
-    /* buttons */
-  TOKEN_MARKER_MISC,
-    WPS_TOKEN_DRAW_INBUILTBAR,
-    WPS_TOKEN_LIST_TITLE_TEXT,
-    WPS_TOKEN_LIST_TITLE_ICON,
-    WPS_TOKEN_BUTTON_VOLUME,
-    WPS_TOKEN_LASTTOUCH,
-#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
-    /* Virtual LED */
-    WPS_TOKEN_VLED_HDD,
-#endif
-    /* Volume level */
-    WPS_TOKEN_VOLUME,
-    WPS_TOKEN_VOLUMEBAR,
-    /* hold */
-    WPS_TOKEN_MAIN_HOLD,
-#ifdef HAS_REMOTE_BUTTON_HOLD
-    WPS_TOKEN_REMOTE_HOLD,
-#endif
-
-    /* Setting option */
-    WPS_TOKEN_SETTING,
-    WPS_TOKEN_CURRENT_SCREEN,
-    WPS_TOKEN_LANG_IS_RTL,
-    
-    /* Recording Tokens */
-  TOKEN_MARKER_RECORDING,
-    WPS_TOKEN_HAVE_RECORDING,
-    WPS_TOKEN_IS_RECORDING,
-    WPS_TOKEN_REC_FREQ,
-    WPS_TOKEN_REC_ENCODER,
-    WPS_TOKEN_REC_BITRATE, /* SWCODEC: MP3 bitrate, HWCODEC: MP3 "quality" */
-    WPS_TOKEN_REC_MONO,
-    WPS_TOKEN_REC_SECONDS,
-    WPS_TOKEN_REC_MINUTES,
-    WPS_TOKEN_REC_HOURS,
-    
-    
-    /* Radio Tokens */
-  TOKEN_MARKER_TUNER,
-    WPS_TOKEN_HAVE_TUNER,
-#if CONFIG_TUNER
-    WPS_TOKEN_TUNER_TUNED,
-    WPS_TOKEN_TUNER_SCANMODE,
-    WPS_TOKEN_TUNER_STEREO,
-    WPS_TOKEN_TUNER_MINFREQ, /* changes based on "region" */
-    WPS_TOKEN_TUNER_MAXFREQ, /* changes based on "region" */
-    WPS_TOKEN_TUNER_CURFREQ,
-    WPS_TOKEN_PRESET_ID, /* "id" of this preset.. really the array element number */
-    WPS_TOKEN_PRESET_NAME,
-    WPS_TOKEN_PRESET_FREQ,
-    WPS_TOKEN_PRESET_COUNT,
-    /* RDS tokens */
-    WPS_TOKEN_HAVE_RDS,
-#ifdef HAVE_RDS_CAP
-    WPS_TOKEN_RDS_NAME,
-    WPS_TOKEN_RDS_TEXT,
-#endif
-#endif /* CONFIG_TUNER */
-    
-    
-  TOKEN_MARKER_END, /* this needs to be the last value in this enum */
-};
-
 struct wps_token {
     unsigned char type; /* enough to store the token type */
 
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index f3f8337..1d8163f 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -24,6 +24,8 @@
  
 #ifndef _WPS_ENGINE_INTERNALS_
 #define _WPS_ENGINE_INTERNALS_
+
+
 /* Timeout unit expressed in HZ. In WPS, all timeouts are given in seconds
    (possibly with a decimal fraction) but stored as integer values.
    E.g. 2.5 is stored as 25. This means 25 tenth of a second, i.e. 25 units.
@@ -32,6 +34,7 @@
 #define DEFAULT_SUBLINE_TIME_MULTIPLIER 20 /* In TIMEOUT_UNIT's */
 
 #include "skin_tokens.h"
+#include "tag_table.h"
 
 
 /* TODO: sort this mess out */
@@ -40,19 +43,6 @@
 #include "statusbar.h"
 #include "metadata.h"
 
-/* constants used in line_type and as refresh_mode for wps_refresh */
-#define WPS_REFRESH_STATIC          (1u<<0)  /* line doesn't change over time */
-#define WPS_REFRESH_DYNAMIC         (1u<<1)  /* line may change (e.g. time flag) */
-#define WPS_REFRESH_SCROLL          (1u<<2)  /* line scrolls */
-#define WPS_REFRESH_PLAYER_PROGRESS (1u<<3)  /* line contains a progress bar */
-#define WPS_REFRESH_PEAK_METER      (1u<<4)  /* line contains a peak meter */
-#define WPS_REFRESH_STATUSBAR       (1u<<5)  /* refresh statusbar */
-#define WPS_REFRESH_ALL       (0xffffffffu)   /* to refresh all line types */
-
-/* to refresh only those lines that change over time */
-#define WPS_REFRESH_NON_STATIC (WPS_REFRESH_DYNAMIC| \
-                                WPS_REFRESH_PLAYER_PROGRESS| \
-                                WPS_REFRESH_PEAK_METER)
 /* alignments */
 #define WPS_ALIGN_RIGHT 32
 #define WPS_ALIGN_CENTER 64
@@ -82,7 +72,6 @@ struct gui_img {
     short int y;                  /* y-pos */
     short int num_subimages;      /* number of sub-images */
     short int subimage_height;    /* height of each sub-image */
-    short int display;            /* -1 for no display, 0..n to display a subimage */
     struct bitmap bm;
     char label;
     bool loaded;            /* load state */
@@ -91,7 +80,7 @@ struct gui_img {
 
 
 struct progressbar {
-    enum wps_token_type type;
+    enum skin_token_type type;
     struct viewport *vp;
     /* regular pb */
     short x;
@@ -157,45 +146,6 @@ enum wps_parse_error {
     PARSE_FAIL_LIMITS_EXCEEDED,
 };
 
-
-/* Description of a subline on the WPS */
-struct skin_subline {
-
-    /* Index of the first token for this subline in the token array.
-       Tokens of this subline end where tokens for the next subline
-       begin. */
-    unsigned short first_token_idx;
-    unsigned short last_token_idx;
-
-    /* Bit or'ed WPS_REFRESH_xxx */
-    unsigned char line_type;
-
-    /* How long the subline should be displayed, in 10ths of sec */
-    unsigned char time_mult;
-    
-    /* pointer to the next subline in this line */
-    struct skin_subline *next;
-};
-
-/* Description of a line on the WPS. A line is a set of sublines.
-   A subline is displayed for a certain amount of time. After that,
-   the next subline of the line is displayed. And so on. */
-struct skin_line {
-
-    /* Linked list of all the sublines on this line,
-     * a line *must* have at least one subline so no need to add an extra pointer */
-    struct skin_subline sublines;
-    /* pointer to the current subline */
-    struct skin_subline *curr_subline;
-
-    /* When the next subline of this line should be displayed
-       (absolute time value in ticks) */
-    long subline_expire_time;
-    
-    /* pointer to the next line */
-    struct skin_line *next;
-};
-
 #define VP_DRAW_HIDEABLE    0x1
 #define VP_DRAW_HIDDEN      0x2
 #define VP_DRAW_WASHIDDEN   0x4
@@ -206,7 +156,6 @@ struct skin_line {
 #define VP_INFO_LABEL       0x80
 struct skin_viewport {
     struct viewport vp;   /* The LCD viewport struct */
-    struct skin_line *lines;
     char hidden_flags;
     char label;
     unsigned start_fgcolour;
@@ -251,7 +200,7 @@ struct playlistviewer {
     struct mp3entry tempid3;
 #endif
     struct {
-        enum wps_token_type tokens[MAX_PLAYLISTLINE_TOKENS];
+        char tokens[MAX_PLAYLISTLINE_TOKENS];
         char strings[MAX_PLAYLISTLINE_STRINGS][MAX_PLAYLISTLINE_STRLEN];
         int count;
         bool scroll;
@@ -262,24 +211,40 @@ struct playlistviewer {
 #ifdef HAVE_ALBUMART
 struct skin_albumart {
     /* Album art support */
-    struct viewport *vp;/* The viewport this is in */
     int x;
     int y;
     int width;
     int height;
 
-    bool draw;
     unsigned char xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */
     unsigned char yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */
     unsigned char state; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */
 };
 #endif
 
+
+struct line {
+    int timeout; /* if inside a line alternator */
+    unsigned update_mode;
+};
+
+struct line_alternator {
+    int current_line;
+    unsigned long last_change_tick;
+};
+
+struct conditional {
+    int last_value;
+    struct wps_token *token;
+};
+
+
 /* wps_data
    this struct holds all necessary data which describes the
    viewable content of a wps */
 struct wps_data
 {
+    struct skin_element *tree;
 #ifdef HAVE_LCD_BITMAP
     struct skin_token_list *images;
     struct skin_token_list *progressbars;
@@ -291,16 +256,11 @@ struct wps_data
 #ifdef HAVE_TOUCHSCREEN
     struct skin_token_list *touchregions;
 #endif
-    struct skin_token_list *viewports;
-    struct skin_token_list *strings;
 #ifdef HAVE_ALBUMART
     struct skin_albumart *albumart;
     int    playback_aa_slot;
 #endif
     struct wps_token *tokens;
-    /* Total number of tokens in the WPS. During WPS parsing, this is
-       the index of the token being parsed. */
-    int num_tokens;
 
 #ifdef HAVE_LCD_BITMAP
     bool peak_meter_enabled;
diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
index 168b17f..954c3f2 100644
--- a/apps/gui/statusbar-skinned.c
+++ b/apps/gui/statusbar-skinned.c
@@ -27,6 +27,7 @@
 #include "appevents.h"
 #include "screens.h"
 #include "screen_access.h"
+#include "skin_parser.h"
 #include "skin_engine/skin_engine.h"
 #include "skin_engine/wps_internals.h"
 #include "viewport.h"
@@ -50,14 +51,14 @@ bool sb_set_title_text(char* title, enum themable_icons icon, enum screen_type s
 {
     int i;
     bool retval = false;
-    for(i=0; i<sb_skin_data[screen].num_tokens; i++)
+    for(i=0; i<0/*FIXME sb_skin_data[screen].num_tokens*/; i++)
     {
-        if (sb_skin_data[screen].tokens[i].type == WPS_TOKEN_LIST_TITLE_TEXT)
+        if (sb_skin_data[screen].tokens[i].type == SKIN_TOKEN_LIST_TITLE_TEXT)
         {
             sb_skin_data[screen].tokens[i].value.data = title;
             retval = true;
         }
-        else if (sb_skin_data[screen].tokens[i].type == WPS_TOKEN_LIST_TITLE_ICON)
+        else if (sb_skin_data[screen].tokens[i].type == SKIN_TOKEN_LIST_TITLE_ICON)
         {
             /* Icon_NOICON == -1 which the skin engine wants at position 1, so + 2 */
             sb_skin_data[screen].tokens[i].value.i = icon+2;
@@ -75,18 +76,22 @@ void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile)
     success = buf && skin_data_load(screen, data, buf, isfile);
 
     if (success)
-    {  /* hide the sb's default viewport because it has nasty effect with stuff
+    {  
+        /* hide the sb's default viewport because it has nasty effect with stuff
         * not part of the statusbar,
         * hence .sbs's without any other vps are unsupported*/
         struct skin_viewport *vp = find_viewport(VP_DEFAULT_LABEL, data);
-        struct skin_token_list *next_vp = data->viewports->next;
-
-        if (!next_vp)
-        {    /* no second viewport, let parsing fail */
-            success = false;
+        struct skin_element *next_vp = data->tree->next;
+        
+        if (vp)
+        {
+            if (!next_vp)
+            {    /* no second viewport, let parsing fail */
+                success = false;
+            }
+            /* hide this viewport, forever */
+            vp->hidden_flags = VP_NEVER_VISIBLE;
         }
-        /* hide this viewport, forever */
-        vp->hidden_flags = VP_NEVER_VISIBLE;
         sb_set_info_vp(screen, VP_INFO_LABEL|VP_DEFAULT_LABEL);
     }
 
@@ -158,7 +163,7 @@ void sb_skin_update(enum screen_type screen, bool force)
         if (lcd_active() || (i != SCREEN_MAIN))
 #endif
             skin_update(&sb_skin[i], force?
-                    WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC);
+                    SKIN_REFRESH_ALL : SKIN_REFRESH_NON_STATIC);
         next_update[i] = current_tick + update_delay; /* don't update too often */
         sb_skin[SCREEN_MAIN].sync_data->do_full_update = false;
     }
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c
index 7d79e5f..2b1cc9e 100644
--- a/apps/gui/viewport.c
+++ b/apps/gui/viewport.c
@@ -310,13 +310,6 @@ static void set_default_align_flags(struct viewport *vp)
 #endif /* HAVE_LCD_BITMAP */
 #endif /* __PCTOOL__ */
 
-#ifdef HAVE_LCD_COLOR
-#define ARG_STRING(_depth) ((_depth) == 2 ? "dddddgg":"dddddcc")
-#else
-#define ARG_STRING(_depth) "dddddgg"
-#endif
-
-
 void viewport_set_fullscreen(struct viewport *vp,
                               const enum screen_type screen)
 {
@@ -416,81 +409,4 @@ int get_viewport_default_colour(enum screen_type screen, bool fgcolour)
 #endif /* LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1 */
 }
 
-const char* viewport_parse_viewport(struct viewport *vp,
-                                    enum screen_type screen,
-                                    const char *bufptr,
-                                    const char separator)
-{
-    /* parse the list to the viewport struct */
-    const char *ptr = bufptr;
-    uint32_t set = 0;
-
-    enum {
-        PL_X = 0,
-        PL_Y,
-        PL_WIDTH,
-        PL_HEIGHT,
-        PL_FONT,
-    };
-    
-    if (!(ptr = parse_list("ddddd", &set, separator, ptr,
-                &vp->x, &vp->y, &vp->width, &vp->height, &vp->font)))
-        return NULL;
-
-    /* X and Y *must* be set */
-    if (!LIST_VALUE_PARSED(set, PL_X) || !LIST_VALUE_PARSED(set, PL_Y))
-        return NULL;
-    /* check for negative values */
-    if (vp->x < 0)
-        vp->x += screens[screen].lcdwidth;
-    if (vp->y < 0)
-        vp->y += screens[screen].lcdheight;
-        
-    /* fix defaults, 
-     * and negative width/height which means "extend to edge minus value */
-    if (!LIST_VALUE_PARSED(set, PL_WIDTH))
-        vp->width = screens[screen].lcdwidth - vp->x;
-    else if (vp->width < 0)
-        vp->width = (vp->width + screens[screen].lcdwidth) - vp->x;
-    if (!LIST_VALUE_PARSED(set, PL_HEIGHT))
-        vp->height = screens[screen].lcdheight - vp->y;
-    else if (vp->height < 0)
-        vp->height = (vp->height + screens[screen].lcdheight) - vp->y;
-
-#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)
-    vp->fg_pattern = get_viewport_default_colour(screen, true);
-    vp->bg_pattern = get_viewport_default_colour(screen, false);
-#endif /* LCD_DEPTH > 1 || LCD_REMOTE_DEPTH > 1 */
-
-#ifdef HAVE_LCD_COLOR
-    vp->lss_pattern = global_settings.lss_color;
-    vp->lse_pattern = global_settings.lse_color;
-    vp->lst_pattern = global_settings.lst_color;
-#endif
-
-    /* Validate the viewport dimensions - we know that the numbers are
-       non-negative integers, ignore bars and assume the viewport takes them
-       * into account */
-    if ((vp->x >= screens[screen].lcdwidth) ||
-        ((vp->x + vp->width) > screens[screen].lcdwidth) ||
-        (vp->y >= screens[screen].lcdheight) ||
-        ((vp->y + vp->height) > screens[screen].lcdheight))
-    {
-        return NULL;
-    }
-
-    /* Default to using the user font if the font was an invalid number or '-'
-     * font 1 is *always* the UI font for the current screen
-     * 2 is always the first extra font    */
-    if (!LIST_VALUE_PARSED(set, PL_FONT))
-        vp->font = FONT_UI;
-
-    /* Set the defaults for fields not user-specified */
-    vp->drawmode = DRMODE_SOLID;
-#ifndef __PCTOOL__
-    set_default_align_flags(vp);
-#endif
-
-    return ptr;
-}
 #endif
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h
index 943cac2..51ab35e 100644
--- a/apps/gui/viewport.h
+++ b/apps/gui/viewport.h
@@ -74,25 +74,4 @@ bool viewport_point_within_vp(const struct viewport *vp,
 
 #endif /* __PCTOOL__ */
 
-#ifdef HAVE_LCD_BITMAP
-
-/*
- * Parse a viewport definition (vp_def), which looks like:
- *
- * Screens with depth > 1:
- *   X|Y|width|height|font|foregorund color|background color
- * Screens with depth = 1:
- *   X|Y|width|height|font
- *
- * | is a separator and can be specified via the parameter
- *
- * Returns the pointer to the char after the last character parsed
- * if everything went OK or NULL if an error happened (some values
- * not specified in the definition)
- */
-const char* viewport_parse_viewport(struct viewport *vp,
-                                    enum screen_type screen,
-                                    const char *vp_def,
-                                    const char separator);
-#endif /* HAVE_LCD_BITMAP */
 #endif /* __VIEWPORT_H__ */
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 6b5270e..aa97dd9 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -175,7 +175,7 @@ void fade(bool fade_in, bool updatewps)
             if (updatewps)
             {
                 FOR_NB_SCREENS(i)
-                    skin_update(&gui_wps[i], WPS_REFRESH_NON_STATIC);
+                    skin_update(&gui_wps[i], SKIN_REFRESH_NON_STATIC);
             }
             sleep(1);
         }
@@ -191,7 +191,7 @@ void fade(bool fade_in, bool updatewps)
             if (updatewps)
             {
                 FOR_NB_SCREENS(i)
-                    skin_update(&gui_wps[i], WPS_REFRESH_NON_STATIC);
+                    skin_update(&gui_wps[i], SKIN_REFRESH_NON_STATIC);
             }
             sleep(1);
         }
@@ -212,7 +212,7 @@ void fade(bool fade_in, bool updatewps)
 
 static bool update_onvol_change(struct gui_wps * gwps)
 {
-    skin_update(gwps, WPS_REFRESH_NON_STATIC);
+    skin_update(gwps, SKIN_REFRESH_NON_STATIC);
 
 #ifdef HAVE_LCD_CHARCELLS
     splashf(0, "Vol: %3d dB",
@@ -372,8 +372,8 @@ bool ffwd_rew(int button)
                 FOR_NB_SCREENS(i)
                 {
                     skin_update(&gui_wps[i],
-                                WPS_REFRESH_PLAYER_PROGRESS |
-                                WPS_REFRESH_DYNAMIC);
+                                SKIN_REFRESH_PLAYER_PROGRESS |
+                                SKIN_REFRESH_DYNAMIC);
                 }
 
                 break;
@@ -390,7 +390,7 @@ bool ffwd_rew(int button)
 #endif
 #ifdef HAVE_LCD_CHARCELLS
                 FOR_NB_SCREENS(i)
-                    skin_update(&gui_wps[i], WPS_REFRESH_ALL);
+                    skin_update(&gui_wps[i], SKIN_REFRESH_ALL);
 #endif
                 exit = true;
                 break;
@@ -662,7 +662,7 @@ static void gwps_enter_wps(void)
         display->backdrop_show(gwps->data->backdrop);
 #endif
         display->clear_display();
-        skin_update(gwps, WPS_REFRESH_ALL);
+        skin_update(gwps, SKIN_REFRESH_ALL);
 
 #ifdef HAVE_TOUCHSCREEN
         skin_disarm_touchregions(gui_wps[i].data);
@@ -1124,7 +1124,7 @@ long gui_wps_show(void)
 #endif
                 {
                     skin_update(&gui_wps[i], wps_sync_data.do_full_update ?
-                                            WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC);
+                                            SKIN_REFRESH_ALL : SKIN_REFRESH_NON_STATIC);
                 }
             }
             wps_sync_data.do_full_update = false;
diff --git a/apps/radio/radio.c b/apps/radio/radio.c
index b675062..49fd9e7 100644
--- a/apps/radio/radio.c
+++ b/apps/radio/radio.c
@@ -799,8 +799,8 @@ int radio_screen(void)
                 if (restore)
                     fms_fix_displays(FMS_ENTER);
                 FOR_NB_SCREENS(i)
-                    skin_update(fms_get(i), restore ? WPS_REFRESH_ALL :
-                                                      WPS_REFRESH_NON_STATIC);
+                    skin_update(fms_get(i), restore ? SKIN_REFRESH_ALL :
+                                                      SKIN_REFRESH_NON_STATIC);
                 restore = false; 
             }
         }
diff --git a/lib/skin_parser/skin_parser.c b/lib/skin_parser/skin_parser.c
index 2ce41c6..15e8490 100644
--- a/lib/skin_parser/skin_parser.c
+++ b/lib/skin_parser/skin_parser.c
@@ -21,6 +21,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <stdbool.h>
 #include <string.h>
 #include <ctype.h>
 
@@ -35,6 +36,11 @@
 int skin_line = 0;
 int viewport_line = 0;
 
+#ifdef ROCKBOX
+static skin_callback callback = NULL;
+static void* callback_data;
+#endif
+
 /* Auxiliary parsing functions (not visible at global scope) */
 static struct skin_element* skin_parse_viewport(char** document);
 static struct skin_element* skin_parse_line(char** document);
@@ -53,10 +59,23 @@ static int skin_parse_comment(struct skin_element* element, char** document);
 static struct skin_element* skin_parse_code_as_arg(char** document);
 
 
+static void skip_whitespace(char** document)
+{
+    while(**document == ' ' || **document == '\t')
+        (*document)++;
+}
 
+#ifdef ROCKBOX
+struct skin_element* skin_parse(const char* document, 
+                                skin_callback cb, void* cb_data)
+                                
+{
+    callback = cb;
+    callback_data = cb_data;
+#else
 struct skin_element* skin_parse(const char* document)
 {
-
+#endif
     struct skin_element* root = NULL;
     struct skin_element* last = NULL;
 
@@ -126,6 +145,13 @@ static struct skin_element* skin_parse_viewport(char** document)
             skin_line++;
         }
     }
+#ifdef ROCKBOX
+    else if (callback)
+    {
+        if (callback(retval, callback_data) == CALLBACK_ERROR)
+            return NULL;
+    }
+#endif
 
     retval->children_count = 1;
     retval->children = skin_alloc_children(1);
@@ -196,7 +222,6 @@ static struct skin_element* skin_parse_viewport(char** document)
                 return NULL;
 
         }
-
         /* Making sure last is at the end */
         while(last->next)
             last = last->next;
@@ -260,6 +285,19 @@ static struct skin_element* skin_parse_line_optional(char** document,
     if(retval->children_count > 0)
         retval->children = skin_alloc_children(1);
 
+#ifdef ROCKBOX
+    if (callback)
+    {
+        switch (callback(retval, callback_data))
+        {
+            case CALLBACK_ERROR:
+                return NULL;
+            default:
+                break;
+        }
+    }
+#endif
+
     while(*cursor != '\n' && *cursor != '\0' && *cursor != MULTILINESYM
           && !((*cursor == ARGLISTSEPERATESYM
                 || *cursor == ARGLISTCLOSESYM
@@ -303,9 +341,10 @@ static struct skin_element* skin_parse_line_optional(char** document,
         }
     }
 
+
     /* Moving up the calling function's pointer */
     *document = cursor;
-
+    
     if(root)
         retval->children[0] = root;
     return retval;
@@ -389,6 +428,13 @@ static struct skin_element* skin_parse_sublines_optional(char** document,
         }
     }
 
+#ifdef ROCKBOX
+    if (callback)
+    {
+        if (callback(retval, callback_data) == CALLBACK_ERROR)
+            return NULL;
+    }
+#endif
     *document = cursor;
 
     return retval;
@@ -455,6 +501,14 @@ static int skin_parse_tag(struct skin_element* element, char** document)
        || (tag_args[0] == '|' && *cursor != ARGLISTOPENSYM)
        || (star && *cursor != ARGLISTOPENSYM))
     {
+        
+#ifdef ROCKBOX
+        if (callback)
+        {
+            if (callback(element, callback_data) == CALLBACK_ERROR)
+                return 0;
+        }
+#endif
         *document = cursor;
         return 1;
     }
@@ -613,7 +667,13 @@ static int skin_parse_tag(struct skin_element* element, char** document)
         skin_error(INSUFFICIENT_ARGS);
         return 0;
     }
-    
+#ifdef ROCKBOX
+    if (callback)
+    {
+        if (callback(element, callback_data) == CALLBACK_ERROR)
+            return 0;
+    }
+#endif
     *document = cursor;
 
     return 1;
@@ -671,6 +731,14 @@ static int skin_parse_text(struct skin_element* element, char** document,
         cursor++;
     }
     text[length] = '\0';
+    
+#ifdef ROCKBOX
+    if (callback)
+    {
+        if (callback(element, callback_data) == CALLBACK_ERROR)
+            return 0;
+    }
+#endif
 
     *document = cursor;
 
@@ -684,14 +752,40 @@ static int skin_parse_conditional(struct skin_element* element, char** document)
     char* bookmark;
     int children = 1;
     int i;
+    
+#ifdef ROCKBOX
+    bool feature_available = true;
+    char *false_branch = NULL;
+#endif
 
-    element->type = CONDITIONAL;
+    /* Some conditional tags allow for target feature checking,
+     * so to handle that call the callback as usual with type == TAG
+     * then call it a second time with type == CONDITIONAL and check the return
+     * value */
+    element->type = TAG;
     element->line = skin_line;
 
     /* Parsing the tag first */
     if(!skin_parse_tag(element, &cursor))
         return 0;
 
+    element->type = CONDITIONAL;
+#ifdef ROCKBOX
+    if (callback)
+    {
+        switch (callback(element, callback_data))
+        {
+            case FEATURE_NOT_AVAILABLE:
+                feature_available = false;
+                break;
+            case CALLBACK_ERROR:
+                return 0;
+            default:
+                break;
+        }
+    }
+#endif
+    
     /* Counting the children */
     if(*(cursor++) != ENUMLISTOPENSYM)
     {
@@ -720,14 +814,31 @@ static int skin_parse_conditional(struct skin_element* element, char** document)
         {
             children++;
             cursor++;
+#ifdef ROCKBOX
+            if (false_branch == NULL && !feature_available)
+            {
+                false_branch = cursor;
+                children--;
+            }
+#endif
         }
         else
         {
             cursor++;
         }
     }
+#ifdef ROCKBOX
+    if (*cursor == ENUMLISTCLOSESYM && 
+        false_branch == NULL && !feature_available)
+    {
+        false_branch = cursor+1;
+        children--;
+    }
+    /* if we are skipping the true branch fix that up */
+    cursor = false_branch ? false_branch : bookmark;
+#else
     cursor = bookmark;
-
+#endif
     /* Parsing the children */
     element->children = skin_alloc_children(children);
     element->children_count = children;
diff --git a/lib/skin_parser/skin_parser.h b/lib/skin_parser/skin_parser.h
index 126a014..0d03340 100644
--- a/lib/skin_parser/skin_parser.h
+++ b/lib/skin_parser/skin_parser.h
@@ -113,14 +113,27 @@ struct skin_element
     struct skin_element* next;
 };
 
+enum skin_cb_returnvalue
+{
+    CALLBACK_ERROR = -666,
+    FEATURE_NOT_AVAILABLE,
+    CALLBACK_OK = 0,
+    /* > 0 reserved for future use */
+};
+typedef int (*skin_callback)(struct skin_element* element, void* data);
+
 /***********************************************************************
  ***** Functions *******************************************************
  **********************************************************************/
 
 /* Parses a WPS document and returns a list of skin_element
    structures. */
+#ifdef ROCKBOX
+struct skin_element* skin_parse(const char* document, 
+                                skin_callback callback, void* callback_data);
+#else
 struct skin_element* skin_parse(const char* document);
-
+#endif
 /* Memory management functions */
 struct skin_element* skin_alloc_element(void);
 struct skin_element** skin_alloc_children(int count);
diff --git a/lib/skin_parser/skin_scan.c b/lib/skin_parser/skin_scan.c
index 79f7162..81d0d25 100644
--- a/lib/skin_parser/skin_scan.c
+++ b/lib/skin_parser/skin_scan.c
@@ -40,12 +40,6 @@ void skip_comment(char** document)
         (*document)++;
 }
 
-void skip_whitespace(char** document)
-{
-    while(**document == ' ' || **document == '\t')
-        (*document)++;
-}
-
 void skip_arglist(char** document)
 {
     if(**document == ARGLISTOPENSYM)
diff --git a/lib/skin_parser/skin_scan.h b/lib/skin_parser/skin_scan.h
index b1d04a6..72d4475 100644
--- a/lib/skin_parser/skin_scan.h
+++ b/lib/skin_parser/skin_scan.h
@@ -30,7 +30,6 @@ extern "C"
 
 /* Scanning functions */
 void skip_comment(char** document);
-void skip_whitespace(char** document);
 void skip_arglist(char** document);
 void skip_enumlist(char** document);
 char* scan_string(char** document);
diff --git a/lib/skin_parser/tag_table.c b/lib/skin_parser/tag_table.c
index e0247ef..8014c54 100644
--- a/lib/skin_parser/tag_table.c
+++ b/lib/skin_parser/tag_table.c
@@ -33,182 +33,182 @@ struct tag_info legal_tags[] =
     { SKIN_TOKEN_ALIGN_RIGHT_RTL,       "aR", "", 0 },
     { SKIN_TOKEN_ALIGN_LANGDIRECTION,   "ax", "", 0 },
     
-    { SKIN_TOKEN_BATTERY_PERCENT,       "bl" , BAR_PARAMS, 0 },
-    { SKIN_TOKEN_BATTERY_VOLTS,         "bv", "", 0 },
-    { SKIN_TOKEN_BATTERY_TIME,          "bt", "", 0 },
-    { SKIN_TOKEN_BATTERY_SLEEPTIME,     "bs", "", 0 },
-    { SKIN_TOKEN_BATTERY_CHARGING,      "bc", "", 0 },
-    { SKIN_TOKEN_BATTERY_CHARGER_CONNECTED, "bp", "", 0 },
-    { SKIN_TOKEN_USB_POWERED,           "bu", "", 0 },
+    { SKIN_TOKEN_BATTERY_PERCENT,       "bl" , BAR_PARAMS, SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_BATTERY_VOLTS,         "bv", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_BATTERY_TIME,          "bt", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_BATTERY_SLEEPTIME,     "bs", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_BATTERY_CHARGING,      "bc", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_BATTERY_CHARGER_CONNECTED, "bp", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_USB_POWERED,           "bu", "", SKIN_REFRESH_DYNAMIC },
     
     
-    { SKIN_TOKEN_RTC_PRESENT,           "cc", "", 0 },
-    { SKIN_TOKEN_RTC_DAY_OF_MONTH,      "cd", "", 0 },
-    { SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, "ce", "", 0 },
-    { SKIN_TOKEN_RTC_12HOUR_CFG,        "cf", "", 0 },
-    { SKIN_TOKEN_RTC_HOUR_24_ZERO_PADDED, "cH", "", 0 },
-    { SKIN_TOKEN_RTC_HOUR_24,           "ck", "", 0 },
-    { SKIN_TOKEN_RTC_HOUR_12_ZERO_PADDED, "cI", "", 0 },
-    { SKIN_TOKEN_RTC_HOUR_12,           "cl", "", 0 },
-    { SKIN_TOKEN_RTC_MONTH,             "cm", "", 0 },
-    { SKIN_TOKEN_RTC_MINUTE,            "cM", "", 0 },
-    { SKIN_TOKEN_RTC_SECOND,            "cS", "", 0 },
-    { SKIN_TOKEN_RTC_YEAR_2_DIGITS,     "cy", "", 0 },
-    { SKIN_TOKEN_RTC_YEAR_4_DIGITS,     "cY", "", 0 },
-    { SKIN_TOKEN_RTC_AM_PM_UPPER,       "cP", "", 0 },
-    { SKIN_TOKEN_RTC_AM_PM_LOWER,       "cp", "", 0 },
-    { SKIN_TOKEN_RTC_WEEKDAY_NAME,      "ca", "", 0 },
-    { SKIN_TOKEN_RTC_MONTH_NAME,        "cb", "", 0 },
-    { SKIN_TOKEN_RTC_DAY_OF_WEEK_START_MON, "cu", "", 0 },
-    { SKIN_TOKEN_RTC_DAY_OF_WEEK_START_SUN, "cw", "", 0 },
+    { SKIN_TOKEN_RTC_PRESENT,           "cc", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_RTC_DAY_OF_MONTH,      "cd", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED, "ce", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_12HOUR_CFG,        "cf", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_HOUR_24_ZERO_PADDED, "cH", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_HOUR_24,           "ck", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_HOUR_12_ZERO_PADDED, "cI", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_HOUR_12,           "cl", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_MONTH,             "cm", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_MINUTE,            "cM", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_SECOND,            "cS", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_YEAR_2_DIGITS,     "cy", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_YEAR_4_DIGITS,     "cY", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_AM_PM_UPPER,       "cP", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_AM_PM_LOWER,       "cp", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_WEEKDAY_NAME,      "ca", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_MONTH_NAME,        "cb", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_DAY_OF_WEEK_START_MON, "cu", "", SKIN_RTC_REFRESH },
+    { SKIN_TOKEN_RTC_DAY_OF_WEEK_START_SUN, "cw", "", SKIN_RTC_REFRESH },
         
-    { SKIN_TOKEN_FILE_BITRATE,          "fb", "", 0 },
-    { SKIN_TOKEN_FILE_CODEC,            "fc", "", 0 },
-    { SKIN_TOKEN_FILE_FREQUENCY,        "ff", "", 0 },
-    { SKIN_TOKEN_FILE_FREQUENCY_KHZ,    "fk", "", 0 },
-    { SKIN_TOKEN_FILE_NAME_WITH_EXTENSION,  "fm", "", 0 },
-    { SKIN_TOKEN_FILE_NAME,             "fn", "", 0 },
-    { SKIN_TOKEN_FILE_PATH,             "fp", "", 0 },
-    { SKIN_TOKEN_FILE_SIZE,             "fs", "", 0 },
-    { SKIN_TOKEN_FILE_VBR,              "fv", "", 0 },
-    { SKIN_TOKEN_FILE_DIRECTORY,        "d"  , "I", 0 },
+    { SKIN_TOKEN_FILE_BITRATE,          "fb", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_CODEC,            "fc", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_FREQUENCY,        "ff", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_FREQUENCY_KHZ,    "fk", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_NAME_WITH_EXTENSION,  "fm", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_NAME,             "fn", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_PATH,             "fp", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_SIZE,             "fs", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_VBR,              "fv", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_DIRECTORY,        "d"  , "I", SKIN_REFRESH_STATIC },
     
-    { SKIN_TOKEN_FILE_BITRATE,          "Fb", "", 0 },
-    { SKIN_TOKEN_FILE_CODEC,            "Fc", "", 0 },
-    { SKIN_TOKEN_FILE_FREQUENCY,        "Ff", "", 0 },
-    { SKIN_TOKEN_FILE_FREQUENCY_KHZ,    "Fk", "", 0 },
-    { SKIN_TOKEN_FILE_NAME_WITH_EXTENSION,  "Fm", "", 0 },
-    { SKIN_TOKEN_FILE_NAME,             "Fn", "", 0 },
-    { SKIN_TOKEN_FILE_PATH,             "Fp", "", 0 },
-    { SKIN_TOKEN_FILE_SIZE,             "Fs", "", 0 },
-    { SKIN_TOKEN_FILE_VBR,              "Fv", "", 0 },
-    { SKIN_TOKEN_FILE_DIRECTORY,        "D"  , "I", 0 },
+    { SKIN_TOKEN_FILE_BITRATE,          "Fb", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_CODEC,            "Fc", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_FREQUENCY,        "Ff", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_FREQUENCY_KHZ,    "Fk", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_NAME_WITH_EXTENSION,  "Fm", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_NAME,             "Fn", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_PATH,             "Fp", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_SIZE,             "Fs", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_VBR,              "Fv", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_FILE_DIRECTORY,        "D"  , "I", SKIN_REFRESH_STATIC },
     
     
-    { SKIN_TOKEN_METADATA_ARTIST,       "ia", "", 0 },
-    { SKIN_TOKEN_METADATA_COMPOSER,     "ic", "", 0 },
-    { SKIN_TOKEN_METADATA_ALBUM,        "id", "", 0 },
-    { SKIN_TOKEN_METADATA_ALBUM_ARTIST, "iA", "", 0 },
-    { SKIN_TOKEN_METADATA_GROUPING,     "iG", "", 0 },
-    { SKIN_TOKEN_METADATA_GENRE,        "ig", "", 0 },
-    { SKIN_TOKEN_METADATA_DISC_NUMBER,  "ik", "", 0 },
-    { SKIN_TOKEN_METADATA_TRACK_NUMBER, "in", "", 0 },
-    { SKIN_TOKEN_METADATA_TRACK_TITLE,  "it", "", 0 },
-    { SKIN_TOKEN_METADATA_VERSION,      "iv", "", 0 },
-    { SKIN_TOKEN_METADATA_YEAR,         "iy", "", 0 },
-    { SKIN_TOKEN_METADATA_COMMENT,      "iC", "", 0 },
+    { SKIN_TOKEN_METADATA_ARTIST,       "ia", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_COMPOSER,     "ic", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_ALBUM,        "id", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_ALBUM_ARTIST, "iA", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_GROUPING,     "iG", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_GENRE,        "ig", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_DISC_NUMBER,  "ik", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_TRACK_NUMBER, "in", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_TRACK_TITLE,  "it", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_VERSION,      "iv", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_YEAR,         "iy", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_COMMENT,      "iC", "", SKIN_REFRESH_STATIC },
     
-    { SKIN_TOKEN_METADATA_ARTIST,       "Ia", "", 0 },
-    { SKIN_TOKEN_METADATA_COMPOSER,     "Ic", "", 0 },
-    { SKIN_TOKEN_METADATA_ALBUM,        "Id", "", 0 },
-    { SKIN_TOKEN_METADATA_ALBUM_ARTIST, "IA", "", 0 },
-    { SKIN_TOKEN_METADATA_GROUPING,     "IG", "", 0 },
-    { SKIN_TOKEN_METADATA_GENRE,        "Ig", "", 0 },
-    { SKIN_TOKEN_METADATA_DISC_NUMBER,  "Ik", "", 0 },
-    { SKIN_TOKEN_METADATA_TRACK_NUMBER, "In", "", 0 },
-    { SKIN_TOKEN_METADATA_TRACK_TITLE,  "It", "", 0 },
-    { SKIN_TOKEN_METADATA_VERSION,      "Iv", "", 0 },
-    { SKIN_TOKEN_METADATA_YEAR,         "Iy", "", 0 },
-    { SKIN_TOKEN_METADATA_COMMENT,      "IC", "", 0 },
+    { SKIN_TOKEN_METADATA_ARTIST,       "Ia", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_COMPOSER,     "Ic", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_ALBUM,        "Id", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_ALBUM_ARTIST, "IA", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_GROUPING,     "IG", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_GENRE,        "Ig", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_DISC_NUMBER,  "Ik", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_TRACK_NUMBER, "In", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_TRACK_TITLE,  "It", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_VERSION,      "Iv", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_YEAR,         "Iy", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_METADATA_COMMENT,      "IC", "", SKIN_REFRESH_STATIC },
     
-    { SKIN_TOKEN_SOUND_PITCH,           "Sp", "", 0 },
-    { SKIN_TOKEN_SOUND_SPEED,           "Ss", "", 0 },
+    { SKIN_TOKEN_SOUND_PITCH,           "Sp", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_SOUND_SPEED,           "Ss", "", SKIN_REFRESH_DYNAMIC },
     
-    { SKIN_TOKEN_VLED_HDD,              "lh", "", 0 },
+    { SKIN_TOKEN_VLED_HDD,              "lh", "", SKIN_REFRESH_DYNAMIC },
     
-    { SKIN_TOKEN_MAIN_HOLD,             "mh", "", 0 },
-    { SKIN_TOKEN_REMOTE_HOLD,           "mr", "", 0 },
-    { SKIN_TOKEN_REPEAT_MODE,           "mm", "", 0 },
-    { SKIN_TOKEN_PLAYBACK_STATUS,       "mp", "", 0 },
-    { SKIN_TOKEN_BUTTON_VOLUME,         "mv", "|S", 0 },
+    { SKIN_TOKEN_MAIN_HOLD,             "mh", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_REMOTE_HOLD,           "mr", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_REPEAT_MODE,           "mm", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_PLAYBACK_STATUS,       "mp", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_BUTTON_VOLUME,         "mv", "|S", SKIN_REFRESH_DYNAMIC },
     
-    { SKIN_TOKEN_PEAKMETER,             "pm", "", 0 },
-    { SKIN_TOKEN_PLAYER_PROGRESSBAR,    "pf", "", 0 },
-    { SKIN_TOKEN_PROGRESSBAR,           "pb" , BAR_PARAMS, 0 },
-    { SKIN_TOKEN_VOLUME,                "pv" , BAR_PARAMS, 0 },
+    { SKIN_TOKEN_PEAKMETER,             "pm", "", SKIN_REFRESH_PEAK_METER },
+    { SKIN_TOKEN_PLAYER_PROGRESSBAR,    "pf", "", SKIN_REFRESH_DYNAMIC|SKIN_REFRESH_PLAYER_PROGRESS },
+    { SKIN_TOKEN_PROGRESSBAR,           "pb" , BAR_PARAMS, SKIN_REFRESH_PLAYER_PROGRESS },
+    { SKIN_TOKEN_VOLUME,                "pv" , BAR_PARAMS, SKIN_REFRESH_DYNAMIC },
     
-    { SKIN_TOKEN_TRACK_ELAPSED_PERCENT, "px", "", 0 },
-    { SKIN_TOKEN_TRACK_TIME_ELAPSED,    "pc", "", 0 },
-    { SKIN_TOKEN_TRACK_TIME_REMAINING,  "pr", "", 0 },
-    { SKIN_TOKEN_TRACK_LENGTH,          "pt", "", 0 },
-    { SKIN_TOKEN_TRACK_STARTING,        "pS" , "|S", 0 },
-    { SKIN_TOKEN_TRACK_ENDING,          "pE" , "|S", 0 },
-    { SKIN_TOKEN_PLAYLIST_POSITION,     "pp", "", 0 },
-    { SKIN_TOKEN_PLAYLIST_ENTRIES,      "pe", "", 0 },
-    { SKIN_TOKEN_PLAYLIST_NAME,         "pn", "", 0 },
-    { SKIN_TOKEN_PLAYLIST_SHUFFLE,      "ps", "", 0 },
+    { SKIN_TOKEN_TRACK_ELAPSED_PERCENT, "px", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_TRACK_TIME_ELAPSED,    "pc", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_TRACK_TIME_REMAINING,  "pr", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_TRACK_LENGTH,          "pt", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_TRACK_STARTING,        "pS" , "|S", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_TRACK_ENDING,          "pE" , "|S", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_PLAYLIST_POSITION,     "pp", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_PLAYLIST_ENTRIES,      "pe", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_PLAYLIST_NAME,         "pn", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_PLAYLIST_SHUFFLE,      "ps", "", SKIN_REFRESH_DYNAMIC },
     
-    { SKIN_TOKEN_DATABASE_PLAYCOUNT,    "rp", "", 0 },
-    { SKIN_TOKEN_DATABASE_RATING,       "rr", "", 0 },
-    { SKIN_TOKEN_DATABASE_AUTOSCORE,    "ra", "", 0 },
+    { SKIN_TOKEN_DATABASE_PLAYCOUNT,    "rp", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_DATABASE_RATING,       "rr", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_DATABASE_AUTOSCORE,    "ra", "", SKIN_REFRESH_DYNAMIC },
     
-    { SKIN_TOKEN_REPLAYGAIN,            "rg", "", 0 },
-    { SKIN_TOKEN_CROSSFADE,             "xf", "", 0 },
+    { SKIN_TOKEN_REPLAYGAIN,            "rg", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_CROSSFADE,             "xf", "", SKIN_REFRESH_DYNAMIC },
     
-    { SKIN_TOKEN_HAVE_TUNER,            "tp", "", 0 },
-    { SKIN_TOKEN_TUNER_TUNED,           "tt", "", 0 },
-    { SKIN_TOKEN_TUNER_SCANMODE,        "tm", "", 0 },
-    { SKIN_TOKEN_TUNER_STEREO,          "ts", "", 0 },
-    { SKIN_TOKEN_TUNER_MINFREQ,         "ta", "", 0 },
-    { SKIN_TOKEN_TUNER_MAXFREQ,         "tb", "", 0 },
-    { SKIN_TOKEN_TUNER_CURFREQ,         "tf", "", 0 },
-    { SKIN_TOKEN_PRESET_ID,             "Ti", "", 0 },
-    { SKIN_TOKEN_PRESET_NAME,           "Tn", "", 0 },
-    { SKIN_TOKEN_PRESET_FREQ,           "Tf", "", 0 },
-    { SKIN_TOKEN_PRESET_COUNT,          "Tc", "", 0 },
-    { SKIN_TOKEN_HAVE_RDS,              "tx", "", 0 },
-    { SKIN_TOKEN_RDS_NAME,              "ty", "", 0 },
-    { SKIN_TOKEN_RDS_TEXT,              "tz", "", 0 },
+    { SKIN_TOKEN_HAVE_TUNER,            "tp", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_TUNER_TUNED,           "tt", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_TUNER_SCANMODE,        "tm", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_TUNER_STEREO,          "ts", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_TUNER_MINFREQ,         "ta", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_TUNER_MAXFREQ,         "tb", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_TUNER_CURFREQ,         "tf", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_PRESET_ID,             "Ti", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_PRESET_NAME,           "Tn", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_PRESET_FREQ,           "Tf", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_PRESET_COUNT,          "Tc", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_HAVE_RDS,              "tx", "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_RDS_NAME,              "ty", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_RDS_TEXT,              "tz", "", SKIN_REFRESH_DYNAMIC },
     
-    { SKIN_TOKEN_SUBLINE_SCROLL,        "s", "", 0 },
+    { SKIN_TOKEN_SUBLINE_SCROLL,        "s", "", SKIN_REFRESH_SCROLL },
     { SKIN_TOKEN_SUBLINE_TIMEOUT,       "t"  , "S", 0 },
     
-    { SKIN_TOKEN_ENABLE_THEME,          "we", "", NOBREAK },
-    { SKIN_TOKEN_DISABLE_THEME,         "wd", "", NOBREAK },
-    { SKIN_TOKEN_DRAW_INBUILTBAR,       "wi", "", NOBREAK },
+    { SKIN_TOKEN_ENABLE_THEME,          "we", "", 0|NOBREAK },
+    { SKIN_TOKEN_DISABLE_THEME,         "wd", "", 0|NOBREAK },
+    { SKIN_TOKEN_DRAW_INBUILTBAR,       "wi", "", SKIN_REFRESH_STATIC|NOBREAK },
     
-    { SKIN_TOKEN_IMAGE_PRELOAD,         "xl", "SFII|I", NOBREAK },
+    { SKIN_TOKEN_IMAGE_PRELOAD,         "xl", "SFII|I", 0|NOBREAK },
     { SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY, "xd", "S", 0 },
-    { SKIN_TOKEN_IMAGE_PRELOAD,         "x", "SFII", NOBREAK },
+    { SKIN_TOKEN_IMAGE_PRELOAD,         "x", "SFII", 0|NOBREAK },
     
-    { SKIN_TOKEN_LOAD_FONT,             "Fl" , "IF", NOBREAK },
-    { SKIN_TOKEN_ALBUMART_LOAD,         "Cl" , "IIII|ss", NOBREAK },
-    { SKIN_TOKEN_ALBUMART_DISPLAY,      "Cd" , "", 0 },
-    { SKIN_TOKEN_ALBUMART_FOUND,        "C" , "", 0 },
+    { SKIN_TOKEN_LOAD_FONT,             "Fl" , "IF", 0|NOBREAK },
+    { SKIN_TOKEN_ALBUMART_LOAD,         "Cl" , "IIII|ss", 0|NOBREAK },
+    { SKIN_TOKEN_ALBUMART_DISPLAY,      "Cd" , "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_ALBUMART_FOUND,        "C" , "", SKIN_REFRESH_STATIC },
     
-    { SKIN_TOKEN_VIEWPORT_ENABLE,       "Vd" , "S", 0 },
-    { SKIN_TOKEN_UIVIEWPORT_ENABLE,     "VI" , "S", 0 },
+    { SKIN_TOKEN_VIEWPORT_ENABLE,       "Vd" , "S", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_UIVIEWPORT_ENABLE,     "VI" , "S", SKIN_REFRESH_STATIC },
     
-    { SKIN_TOKEN_VIEWPORT_CUSTOMLIST,   "Vp" , "ICC", NOBREAK },
-    { SKIN_TOKEN_LIST_TITLE_TEXT,       "Lt" , "", 0 },
-    { SKIN_TOKEN_LIST_TITLE_ICON,       "Li" , "", 0 },
+    { SKIN_TOKEN_VIEWPORT_CUSTOMLIST,   "Vp" , "ICC", SKIN_REFRESH_DYNAMIC|NOBREAK },
+    { SKIN_TOKEN_LIST_TITLE_TEXT,       "Lt" , "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_LIST_TITLE_ICON,       "Li" , "", SKIN_REFRESH_DYNAMIC },
     
-    { SKIN_TOKEN_VIEWPORT_FGCOLOUR,       "Vf" , "S", NOBREAK },
-    { SKIN_TOKEN_VIEWPORT_BGCOLOUR,       "Vb" , "S", NOBREAK },
+    { SKIN_TOKEN_VIEWPORT_FGCOLOUR,       "Vf" , "S", SKIN_REFRESH_STATIC|NOBREAK },
+    { SKIN_TOKEN_VIEWPORT_BGCOLOUR,       "Vb" , "S", SKIN_REFRESH_STATIC|NOBREAK },
     
     { SKIN_TOKEN_VIEWPORT_CONDITIONAL,  "Vl" , "SIIiii", 0 },
     { SKIN_TOKEN_UIVIEWPORT_LOAD,       "Vi" , "sIIiii", 0 },
     { SKIN_TOKEN_VIEWPORT_LOAD,         "V"  , "IIiii", 0 },
     
-    { SKIN_TOKEN_IMAGE_BACKDROP,        "X"  , "f", NOBREAK },
+    { SKIN_TOKEN_IMAGE_BACKDROP,        "X"  , "f", SKIN_REFRESH_STATIC|NOBREAK },
     
-    { SKIN_TOKEN_SETTING,               "St" , "S", 0 },
-    { SKIN_TOKEN_TRANSLATEDSTRING,      "Sx" , "S", 0 },
-    { SKIN_TOKEN_LANG_IS_RTL,           "Sr" , "", 0 },
+    { SKIN_TOKEN_SETTING,               "St" , "S", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_TRANSLATEDSTRING,      "Sx" , "S", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_LANG_IS_RTL,           "Sr" , "", SKIN_REFRESH_STATIC },
     
-    { SKIN_TOKEN_LASTTOUCH,             "Tl" , "|S", 0 },
-    { SKIN_TOKEN_CURRENT_SCREEN,        "cs", "", 0 },
-    { SKIN_TOKEN_TOUCHREGION,           "T"  , "IIiiS", NOBREAK },
+    { SKIN_TOKEN_LASTTOUCH,             "Tl" , "|S", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_CURRENT_SCREEN,        "cs", "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_TOUCHREGION,           "T"  , "IIiiS", 0|NOBREAK },
     
-    { SKIN_TOKEN_HAVE_RECORDING,        "Rp"   , "", 0 },
-    { SKIN_TOKEN_IS_RECORDING,          "Rr"   , "", 0 },
-    { SKIN_TOKEN_REC_FREQ,              "Rf"   , "", 0 },
-    { SKIN_TOKEN_REC_ENCODER,           "Re"   , "", 0 },
-    { SKIN_TOKEN_REC_BITRATE,           "Rb"   , "", 0 },
-    { SKIN_TOKEN_REC_MONO,              "Rm"   , "", 0 },
-    { SKIN_TOKEN_REC_SECONDS,           "Rs"   , "", 0 },
-    { SKIN_TOKEN_REC_MINUTES,           "Rn"   , "", 0 },
-    { SKIN_TOKEN_REC_HOURS,             "Rh"   , "", 0 },
+    { SKIN_TOKEN_HAVE_RECORDING,        "Rp"   , "", SKIN_REFRESH_STATIC },
+    { SKIN_TOKEN_IS_RECORDING,          "Rr"   , "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_REC_FREQ,              "Rf"   , "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_REC_ENCODER,           "Re"   , "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_REC_BITRATE,           "Rb"   , "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_REC_MONO,              "Rm"   , "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_REC_SECONDS,           "Rs"   , "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_REC_MINUTES,           "Rn"   , "", SKIN_REFRESH_DYNAMIC },
+    { SKIN_TOKEN_REC_HOURS,             "Rh"   , "", SKIN_REFRESH_DYNAMIC },
     
     { SKIN_TOKEN_UNKNOWN,                ""   , "", 0 }
     /* Keep this here to mark the end of the table */
diff --git a/lib/skin_parser/tag_table.h b/lib/skin_parser/tag_table.h
index 149f148..176594d 100644
--- a/lib/skin_parser/tag_table.h
+++ b/lib/skin_parser/tag_table.h
@@ -30,9 +30,25 @@ extern "C"
     /* Flag to tell the renderer not to insert a line break */
 #define NOBREAK 0x1
 
+/* constants used in line_type and as refresh_mode for wps_refresh */
+#define SKIN_REFRESH_SHIFT           16
+#define SKIN_REFRESH_STATIC          (1u<<SKIN_REFRESH_SHIFT)  /* line doesn't change over time */
+#define SKIN_REFRESH_DYNAMIC         (1u<<(SKIN_REFRESH_SHIFT+1))  /* line may change (e.g. time flag) */
+#define SKIN_REFRESH_SCROLL          (1u<<(SKIN_REFRESH_SHIFT+2))  /* line scrolls */
+#define SKIN_REFRESH_PLAYER_PROGRESS (1u<<(SKIN_REFRESH_SHIFT+3))  /* line contains a progress bar */
+#define SKIN_REFRESH_PEAK_METER      (1u<<(SKIN_REFRESH_SHIFT+4))  /* line contains a peak meter */
+#define SKIN_REFRESH_STATUSBAR       (1u<<(SKIN_REFRESH_SHIFT+5))  /* refresh statusbar */
+#define SKIN_RTC_REFRESH             (1u<<(SKIN_REFRESH_SHIFT+6))  /* refresh rtc, convert at parse time */
+#define SKIN_REFRESH_ALL             (0xffff<<SKIN_REFRESH_SHIFT)   /* to refresh all line types */
+
+/* to refresh only those lines that change over time */
+#define SKIN_REFRESH_NON_STATIC (SKIN_REFRESH_DYNAMIC| \
+                                 SKIN_REFRESH_PLAYER_PROGRESS| \
+                                 SKIN_REFRESH_PEAK_METER)
 
 enum skin_token_type {
     
+    SKIN_TOKEN_NO_TOKEN,
     SKIN_TOKEN_UNKNOWN,
 
     /* Markers */
@@ -91,7 +107,7 @@ enum skin_token_type {
     /* The begin/end values allow us to know if a token is an RTC one.
        New RTC tokens should be added between the markers. */
 
-    SKIN_TOKENs_RTC_BEGIN, /* just the start marker, not an actual token */
+    SKIN_TOKENS_RTC_BEGIN, /* just the start marker, not an actual token */
 
     SKIN_TOKEN_RTC_DAY_OF_MONTH,
     SKIN_TOKEN_RTC_DAY_OF_MONTH_BLANK_PADDED,
diff --git a/utils/newparser/skin_render.c b/utils/newparser/skin_render.c
index 1690455..09c9ca1 100644
--- a/utils/newparser/skin_render.c
+++ b/utils/newparser/skin_render.c
@@ -43,7 +43,7 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch)
 {
     /* Tags here are ones which need to be "turned off" or cleared 
      * if they are in a conditional branch which isnt being used */
-    if (branch->type == SUBLINES)
+    if (branch->type == LINE_ALTERNATOR)
     {
         int i;
         for (i=0; i<branch->children_count; i++)
@@ -71,7 +71,6 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch)
                     break;
                 case SKIN_TOKEN_IMAGE_DISPLAY:
                 case SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY:
-                    printf("disable image\n");
                     /* clear images */
                     break;
                 default:
@@ -109,7 +108,7 @@ void skin_render_line(struct skin_element* line,
                     do_tags_in_hidden_conditional(child->children[last_value]);
                 last_value = value;
                 
-                if (child->children[value]->type == SUBLINES)
+                if (child->children[value]->type == LINE_ALTERNATOR)
                     func = skin_render_alternator;
                 else if (child->children[value]->type == LINE)
                     func = skin_render_line;
