diff --git a/java/src/com/android/inputmethod/latin/Constants.java b/java/src/com/android/inputmethod/latin/Constants.java
index b497131..494adea 100644
--- a/java/src/com/android/inputmethod/latin/Constants.java
+++ b/java/src/com/android/inputmethod/latin/Constants.java
@@ -158,6 +158,8 @@
 
     // Key events coming any faster than this are long-presses.
     public static final int LONG_PRESS_MILLISECONDS = 200;
+    // TODO: Set this value appropriately.
+    public static final int GET_SUGGESTED_WORDS_TIMEOUT = 200;
     // How many continuous deletes at which to start deleting at a higher speed.
     public static final int DELETE_ACCELERATE_AT = 20;
 
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 6054d29..a941dc3 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -49,14 +49,12 @@
 import android.util.Pair;
 import android.util.PrintWriterPrinter;
 import android.util.Printer;
-import android.view.KeyCharacterMap;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.ViewGroup.LayoutParams;
 import android.view.Window;
 import android.view.WindowManager;
 import android.view.inputmethod.CompletionInfo;
-import android.view.inputmethod.CorrectionInfo;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethodSubtype;
 
@@ -65,9 +63,7 @@
 import com.android.inputmethod.annotations.UsedForTesting;
 import com.android.inputmethod.compat.AppWorkaroundsUtils;
 import com.android.inputmethod.compat.InputMethodServiceCompatUtils;
-import com.android.inputmethod.compat.SuggestionSpanUtils;
 import com.android.inputmethod.dictionarypack.DictionaryPackConstants;
-import com.android.inputmethod.event.EventInterpreter;
 import com.android.inputmethod.keyboard.Keyboard;
 import com.android.inputmethod.keyboard.KeyboardActionListener;
 import com.android.inputmethod.keyboard.KeyboardId;
@@ -80,24 +76,19 @@
 import com.android.inputmethod.latin.inputlogic.SpaceState;
 import com.android.inputmethod.latin.personalization.DictionaryDecayBroadcastReciever;
 import com.android.inputmethod.latin.personalization.PersonalizationDictionarySessionRegister;
-import com.android.inputmethod.latin.personalization.UserHistoryDictionary;
 import com.android.inputmethod.latin.settings.Settings;
 import com.android.inputmethod.latin.settings.SettingsActivity;
 import com.android.inputmethod.latin.settings.SettingsValues;
 import com.android.inputmethod.latin.suggestions.SuggestionStripView;
 import com.android.inputmethod.latin.utils.ApplicationUtils;
-import com.android.inputmethod.latin.utils.AsyncResultHolder;
 import com.android.inputmethod.latin.utils.AutoCorrectionUtils;
 import com.android.inputmethod.latin.utils.CapsModeUtils;
 import com.android.inputmethod.latin.utils.CollectionUtils;
 import com.android.inputmethod.latin.utils.CompletionInfoUtils;
-import com.android.inputmethod.latin.utils.InputTypeUtils;
 import com.android.inputmethod.latin.utils.IntentUtils;
 import com.android.inputmethod.latin.utils.JniUtils;
 import com.android.inputmethod.latin.utils.LatinImeLoggerUtils;
 import com.android.inputmethod.latin.utils.LeakGuardHandlerWrapper;
-import com.android.inputmethod.latin.utils.RecapitalizeStatus;
-import com.android.inputmethod.latin.utils.StringUtils;
 import com.android.inputmethod.latin.utils.TargetPackageInfoGetterTask;
 import com.android.inputmethod.latin.utils.TextRange;
 import com.android.inputmethod.research.ResearchLogger;
@@ -106,8 +97,6 @@
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Locale;
-import java.util.TreeSet;
-import java.util.concurrent.TimeUnit;
 
 /**
  * Input method implementation for Qwerty'ish keyboard.
@@ -117,8 +106,7 @@
         Suggest.SuggestInitializationListener {
     private static final String TAG = LatinIME.class.getSimpleName();
     private static final boolean TRACE = false;
-    // TODO[IL]: Make this private
-    public static boolean DEBUG;
+    private static boolean DEBUG = false;
 
     private static final int EXTENDED_TOUCHABLE_REGION_HEIGHT = 100;
 
@@ -126,9 +114,6 @@
 
     private static final int PERIOD_FOR_AUDIO_AND_HAPTIC_FEEDBACK_IN_KEY_REPEAT = 2;
 
-    // TODO: Set this value appropriately.
-    private static final int GET_SUGGESTED_WORDS_TIMEOUT = 200;
-
     /**
      * The name of the scheme used by the Package Manager to warn of a new package installation,
      * replacement or removal.
@@ -216,7 +201,8 @@
             final KeyboardSwitcher switcher = latinIme.mKeyboardSwitcher;
             switch (msg.what) {
             case MSG_UPDATE_SUGGESTION_STRIP:
-                latinIme.updateSuggestionStrip();
+                latinIme.mInputLogic.performUpdateSuggestionStripSync(
+                        latinIme.mSettings.getCurrent(), this);
                 break;
             case MSG_UPDATE_SHIFT_STATE:
                 switcher.updateShiftState();
@@ -746,14 +732,6 @@
             Log.w(TAG, "Use EditorInfo.IME_FLAG_FORCE_ASCII flag instead");
         }
 
-        final PackageInfo packageInfo =
-                TargetPackageInfoGetterTask.getCachedPackageInfo(editorInfo.packageName);
-        mAppWorkAroundsUtils.setPackageInfo(packageInfo);
-        if (null == packageInfo) {
-            new TargetPackageInfoGetterTask(this /* context */, this /* listener */)
-                    .execute(editorInfo.packageName);
-        }
-
         LatinImeLogger.onStartInputView(editorInfo);
         // In landscape mode, this method gets called without the input view being created.
         if (mainKeyboardView == null) {
@@ -820,6 +798,13 @@
         if (isDifferentTextField) {
             mainKeyboardView.closing();
             loadSettings();
+            final PackageInfo packageInfo =
+                    TargetPackageInfoGetterTask.getCachedPackageInfo(editorInfo.packageName);
+            mAppWorkAroundsUtils.setPackageInfo(packageInfo);
+            if (null == packageInfo) {
+                new TargetPackageInfoGetterTask(this /* context */, this /* listener */)
+                        .execute(editorInfo.packageName);
+            }
             currentSettingsValues = mSettings.getCurrent();
 
             if (suggest != null && currentSettingsValues.mCorrectionEnabled) {
@@ -1756,44 +1741,6 @@
         }
     }
 
-    // TODO[IL]: Move this to InputLogic and make private again
-    public void updateSuggestionStrip() {
-        mHandler.cancelUpdateSuggestionStrip();
-        final SettingsValues currentSettings = mSettings.getCurrent();
-
-        // Check if we have a suggestion engine attached.
-        if (mInputLogic.mSuggest == null
-                || !currentSettings.isSuggestionsRequested(mDisplayOrientation)) {
-            if (mInputLogic.mWordComposer.isComposingWord()) {
-                Log.w(TAG, "Called updateSuggestionsOrPredictions but suggestions were not "
-                        + "requested!");
-            }
-            return;
-        }
-
-        if (!mInputLogic.mWordComposer.isComposingWord()
-                && !currentSettings.mBigramPredictionEnabled) {
-            setPunctuationSuggestions();
-            return;
-        }
-
-        final AsyncResultHolder<SuggestedWords> holder = new AsyncResultHolder<SuggestedWords>();
-        getSuggestedWordsOrOlderSuggestionsAsync(Suggest.SESSION_TYPING,
-                SuggestedWords.NOT_A_SEQUENCE_NUMBER, new OnGetSuggestedWordsCallback() {
-                    @Override
-                    public void onGetSuggestedWords(final SuggestedWords suggestedWords) {
-                        holder.set(suggestedWords);
-                    }
-                }
-        );
-
-        // This line may cause the current thread to wait.
-        final SuggestedWords suggestedWords = holder.get(null, GET_SUGGESTED_WORDS_TIMEOUT);
-        if (suggestedWords != null) {
-            showSuggestionStrip(suggestedWords);
-        }
-    }
-
     private void getSuggestedWords(final int sessionId, final int sequenceNumber,
             final OnGetSuggestedWordsCallback callback) {
         final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
@@ -1833,7 +1780,8 @@
                 additionalFeaturesOptions, sessionId, sequenceNumber, callback);
     }
 
-    private void getSuggestedWordsOrOlderSuggestionsAsync(final int sessionId,
+    // TODO[IL]: Move this to InputLogic?
+    public void getSuggestedWordsOrOlderSuggestionsAsync(final int sessionId,
             final int sequenceNumber, final OnGetSuggestedWordsCallback callback) {
         mInputUpdater.getSuggestedWords(sessionId, sequenceNumber,
                 new OnGetSuggestedWordsCallback() {
@@ -1913,7 +1861,8 @@
       AccessibilityUtils.getInstance().setAutoCorrection(suggestedWords, typedWord);
     }
 
-    private void showSuggestionStrip(final SuggestedWords suggestedWords) {
+    // TODO[IL]: Define a clean interface for this
+    public void showSuggestionStrip(final SuggestedWords suggestedWords) {
         if (suggestedWords.isEmpty()) {
             clearSuggestionStrip();
             return;
diff --git a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
index a433ca6..db27d22 100644
--- a/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
+++ b/java/src/com/android/inputmethod/latin/inputlogic/InputLogic.java
@@ -36,12 +36,14 @@
 import com.android.inputmethod.latin.RichInputConnection;
 import com.android.inputmethod.latin.SubtypeSwitcher;
 import com.android.inputmethod.latin.Suggest;
+import com.android.inputmethod.latin.Suggest.OnGetSuggestedWordsCallback;
 import com.android.inputmethod.latin.SuggestedWords;
 import com.android.inputmethod.latin.WordComposer;
 import com.android.inputmethod.latin.define.ProductionFlag;
 import com.android.inputmethod.latin.personalization.UserHistoryDictionary;
 import com.android.inputmethod.latin.settings.Settings;
 import com.android.inputmethod.latin.settings.SettingsValues;
+import com.android.inputmethod.latin.utils.AsyncResultHolder;
 import com.android.inputmethod.latin.utils.AutoCorrectionUtils;
 import com.android.inputmethod.latin.utils.CollectionUtils;
 import com.android.inputmethod.latin.utils.InputTypeUtils;
@@ -50,7 +52,6 @@
 import com.android.inputmethod.latin.utils.StringUtils;
 import com.android.inputmethod.research.ResearchLogger;
 
-import java.util.Locale;
 import java.util.TreeSet;
 import java.util.concurrent.TimeUnit;
 
@@ -846,6 +847,43 @@
         return prevWord;
     }
 
+    public void performUpdateSuggestionStripSync(final SettingsValues settingsValues,
+            // TODO: Remove this variable
+            final LatinIME.UIHandler handler) {
+        handler.cancelUpdateSuggestionStrip();
+
+        // Check if we have a suggestion engine attached.
+        if (mSuggest == null
+                || !settingsValues.isSuggestionsRequested(mLatinIME.mDisplayOrientation)) {
+            if (mWordComposer.isComposingWord()) {
+                Log.w(TAG, "Called updateSuggestionsOrPredictions but suggestions were not "
+                        + "requested!");
+            }
+            return;
+        }
+
+        if (!mWordComposer.isComposingWord() && !settingsValues.mBigramPredictionEnabled) {
+            mLatinIME.setPunctuationSuggestions();
+            return;
+        }
+
+        final AsyncResultHolder<SuggestedWords> holder = new AsyncResultHolder<SuggestedWords>();
+        mLatinIME.getSuggestedWordsOrOlderSuggestionsAsync(Suggest.SESSION_TYPING,
+                SuggestedWords.NOT_A_SEQUENCE_NUMBER, new OnGetSuggestedWordsCallback() {
+                    @Override
+                    public void onGetSuggestedWords(final SuggestedWords suggestedWords) {
+                        holder.set(suggestedWords);
+                    }
+                }
+        );
+
+        // This line may cause the current thread to wait.
+        final SuggestedWords suggestedWords = holder.get(null,
+                Constants.GET_SUGGESTED_WORDS_TIMEOUT);
+        if (suggestedWords != null) {
+            mLatinIME.showSuggestionStrip(suggestedWords);
+        }
+    }
 
     /**
      * Check if the cursor is actually at the end of a word. If so, restart suggestions on this
@@ -895,7 +933,7 @@
         final int separatorLength = mLastComposedWord.mSeparatorString.length();
         // TODO: should we check our saved separator against the actual contents of the text view?
         final int deleteLength = cancelLength + separatorLength;
-        if (LatinIME.DEBUG) {
+        if (LatinImeLogger.sDBG) {
             if (mWordComposer.isComposingWord()) {
                 throw new RuntimeException("revertCommit, but we are composing a word");
             }
@@ -1226,7 +1264,7 @@
             final LatinIME.UIHandler handler) {
         // Complete any pending suggestions query first
         if (handler.hasPendingUpdateSuggestions()) {
-            mLatinIME.updateSuggestionStrip();
+            performUpdateSuggestionStripSync(settingsValues, handler);
         }
         final String typedAutoCorrection = mWordComposer.getAutoCorrectionOrNull();
         final String typedWord = mWordComposer.getTypedWord();
