public function extractStylesheets($node = null, $base = '', $devices = array('all', 'screen', 'handheld'), $remove = true)
    {
        if(null === $node) {
            $node = $this->_dom;
        }

        $stylesheets = array();
        if($node->hasChildNodes()) {
            $removeQueue = array();
            /** @var $child \DOMElement */
            foreach($node->childNodes as $child) {
                $nodeName = strtolower($child->nodeName);
                if($nodeName === "style" && $this->isForAllowedMediaDevice($child->getAttribute('media'), $devices)) {
                    $stylesheets[] = $child->nodeValue;
                    $removeQueue[] = $child;
                } else if($nodeName === "link" && strtolower($child->getAttribute('rel')) === 'stylesheet' && $this->isForAllowedMediaDevice($child->getAttribute('media'), $devices)) {
                    if($child->hasAttribute("href")) {
                        $href = $child->getAttribute("href");

                        if($base && false === strpos($href, "://")) {
                            $href = "{$base}/{$href}";
                        }

                        $ext = @file_get_contents($href);

                        if($ext) {
                            $removeQueue[] = $child;
                            $stylesheets[] = $ext;
                        }
                    }
                } else {
                    $stylesheets = array_merge($stylesheets,
                        $this->extractStylesheets($child, $base, $devices, $remove));
                }
            }

            if ($remove) {
                foreach ($removeQueue as $child) {
                    $child->parentNode->removeChild($child);
                }
            }
        }

        return $stylesheets;
    }