Improved language recognition (fixes #2)