Implement control flow

No unit tests for now, but increases successful tests in mj-test/run from 56/130 to 111/130.