Added mouse input detection