MainProc logically framed

some code complete.