Look for debouncing a switch to begin with. Any switch is likeley to have the contacts close more that 1 time for and given closure and you need to "debounce" it so you only see it as one button press. I had one switch on the job that was capable of giving 15 bounces for 1 press.