Update chapter.md

Adding main code loop and starting mode by mode breakdown