code: private static List<Element> filterParents(List<Element> elements) {
  		List<Element> filtered = new ArrayList<Element>();
  		for (Element element : elements) {
  			// get the intersection of parents and selected elements
  			List<Element> parentsInter = element.parents();
  			parentsInter.retainAll(elements);
  			if (parentsInter.isEmpty()) {
  				// no intersection - element's parents are not in the selected list
  				filtered.add(element);
  			}
  		}
  
  		return filtered;
  	}
docs: Filters the list of elements to only contain parent elements. This is to avoid both parent
  and child being in the list of elements.
  
  @param elements
  @return