function cleanupElements(JSONcontainer) {
  // cleanup the redundant svgElements;
  for (const elementType in JSONcontainer) {
    if (Object.prototype.hasOwnProperty.call(JSONcontainer, elementType)) {
      if (JSONcontainer[elementType].redundant) {
        for (let i = 0; i < JSONcontainer[elementType].redundant.length; i++) {
          JSONcontainer[elementType].redundant[i].parentNode.removeChild(
            JSONcontainer[elementType].redundant[i]
          );
        }
        JSONcontainer[elementType].redundant = [];
      }
    }
  }
}
this cleans up all the unused SVG elements. By asking for the parentNode, we only need to supply the JSON container from
which to remove the redundant elements.
@param {object} JSONcontainer
@private