Corrected a bit of generated toggle logic

added cases to the demo, improved variable naming