finalized flowchart