Added functionality to touch and mouse handling