added smart language switching