Mouse handling improvements