private Element recursiveParse(Layer l, Element currentParent) throws Exception
	{
		// parent of current layer
		Element e = parseLayer(l);
		LinkedList<Element> children = new LinkedList<Element>();
		
		document.addCSSLine(e.getSelector());
		for(int x = 0; x < l.getLayersCount(); x++)
		{
			// traverse children
			Layer cL = l.getLayer(x);
			
			// ignore layer groups (nesting prob)
			if(!cL.toString().equals("</Layer group>"))
			{
				Element c = recursiveParse(cL, e);
				
				e.addChild(c);	
				
				LayerMatcher lm1 = new LayerMatcher(l);
				LayerMatcher lm2 = new LayerMatcher(cL);
				
				String dummy1ID = lm1.getID();
				String dummy2ID = lm2.getID();
				
				if(l.getType() == LayerType.FOLDER && cL.getType() == LayerType.NORMAL && dummy1ID.equals(dummy2ID)) {
					e.merge(c);
				}
				else {
					children.add(c);
				}
			}
		}	
		
		// iterate the siblings
		for(Element parentChild : children)
		{
			for(Element childChild : children)
			{
				parentChild.addSibling(childChild);
			}
		}
		
		return e;
	}