Added mouse handling code.