public function prepareItems($items)
    {

        if (is_array($items) && !empty($items)) {
            foreach ($items as $key => &$item) {

                //Get linked post object.
                $postData = is_object($item['page']) ? $item['page'] : false;

                //Linking
                if ($item['link_type'] == 'external') {
                    $item['permalink'] = $item['link_url'];
                } elseif (is_object($postData) && isset($postData->ID) && $item['link_type'] == 'internal') {
                    $item['permalink'] = get_permalink($postData->ID);
                }

                //Thumbnail
                $item['thumbnail'] = $this->getThumbnail($item);

                if ($postData !== false && get_post_status($postData->ID)) {

                    //Retrive post content & lead
                    if (is_object($postData) && isset($postData->ID)) {
                        $item['title']          = $this->switchContent($item['title'], $postData->post_title);
                        $item['lead']           = $this->switchContent($item['lead'], $this->parseExcerpt($postData->post_content));
                    }

                } else {
                    unset($item);
                }

                //Removes empty/unfetchable objects from index
                if($item['link_type'] == "internal" && empty($item['title']) && empty($item['lead']) && empty($item['thumbnail']) && empty($item['permalink'])) {
                    unset($items[$key]);
                }

            }
        }

        return $items;
    }