Mouse tracking and bug fixes