A capacitor is a useful tool for reducing unwanted noise. by activating the switch current is allowed to route into the capacitor and be discharged in a way that works against the AC noise generator but allows the logic timer to pass straight through almost unaffected.