Mouse support and better algo