Major refactoring of multitouch handling