Implemented mouse handling