Improved click and dblclick separation in handleEvents().