Added more robust language detector