added final method and flowchart.