Nintendo DS double tap detection

Because my screen is most of the time is pressed I had to come up with a gesture that can be distinguished over single press/tap.

So I decided to make double tap gestures using this code : Link to my code so far

But its not always detecting double tap on screen, any idea how to imporove it ?

That code obviously won't compile, so what it does or doesn't do is moot

This one will compile : new code

This one will compile

Doesn't seem likely.x = readX();

AWOL: Doesn't seem likely.x = readX();

That one is trivial, but ok : http://pastebin.com/SSSZ1GYV

Anyone ?