High going pulse

What? Working perfectly? You're kidding. That line doesn't do anything, so the code following it will execute every time. Is that what you call "working"?

Revisions? What revisions?

Just to be clear, can you describe exactly what (digitalRead(pin)==HIGH && state==LOW); actually does when you use it? Perhaps that will help us understand it.