added Thai's flowchart