added 5th function replacement to flowchart.