working Replaceheading method and add comments