A few minor edits to test if an element is a heading and to reset the parents (otherwise it will keep increasing). Also z-index set to 999 to make sure it is on top of everything