Updated automatic language detection