Ok, before I get into the actual code, here's a short explanation as to how it works:
Each of the two codes is single-activation. You should turn one on, and then deactivate it. Then, if you want to modify things further, you activate the reset, disable the reset, then turn one of the codes on...