Better camera detection algorithm