Implemented toggle mechanism

It simplifies parsing even if it is not perfect