added support for language auto detection