diff --git a/java/AndroidManifest.xml b/java/AndroidManifest.xml
index 7cf0c03..b88c18e 100644
--- a/java/AndroidManifest.xml
+++ b/java/AndroidManifest.xml
@@ -20,8 +20,8 @@
 
     <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17" />
 
-    <uses-permission android:name="android.permission.VIBRATE"/>
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+    <uses-permission android:name="android.permission.VIBRATE" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <uses-permission android:name="android.permission.READ_USER_DICTIONARY" />
     <uses-permission android:name="android.permission.READ_CONTACTS" />
 
@@ -48,23 +48,31 @@
             <meta-data android:name="android.view.textservice.scs" android:resource="@xml/spellchecker" />
         </service>
 
+        <activity android:name=".setup.SetupActivity"
+                android:label="@string/aosp_android_keyboard_ime_name"
+                android:icon="@mipmap/ic_ime_settings">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+
         <activity android:name="SettingsActivity" android:label="@string/english_ime_settings"
                   android:uiOptions="splitActionBarWhenNarrow">
             <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
+                <action android:name="android.intent.action.MAIN" />
             </intent-filter>
         </activity>
 
         <activity android:name="com.android.inputmethod.latin.spellcheck.SpellCheckerSettingsActivity"
                   android:label="@string/android_spell_checker_settings">
             <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
+                <action android:name="android.intent.action.MAIN" />
             </intent-filter>
         </activity>
 
         <activity android:name="DebugSettingsActivity" android:label="@string/english_ime_debug_settings">
             <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
+                <action android:name="android.intent.action.MAIN" />
             </intent-filter>
         </activity>
 
diff --git a/java/res/values-pt-rPT/strings.xml b/java/res/values-pt-rPT/strings.xml
index 2284576..6e65015 100644
--- a/java/res/values-pt-rPT/strings.xml
+++ b/java/res/values-pt-rPT/strings.xml
@@ -72,10 +72,10 @@
     <string name="gesture_floating_preview_text" msgid="4443240334739381053">"Pré-visual. flutuante dinâmica"</string>
     <string name="gesture_floating_preview_text_summary" msgid="4472696213996203533">"Ver palavra sugerida enquanto toca"</string>
     <string name="added_word" msgid="8993883354622484372">"<xliff:g id="WORD">%s</xliff:g>: guardada"</string>
-    <string name="label_go_key" msgid="1635148082137219148">"OK"</string>
+    <string name="label_go_key" msgid="1635148082137219148">"Ir"</string>
     <string name="label_next_key" msgid="362972844525672568">"Avançar"</string>
     <string name="label_previous_key" msgid="1211868118071386787">"Ant."</string>
-    <string name="label_done_key" msgid="2441578748772529288">"Feito"</string>
+    <string name="label_done_key" msgid="2441578748772529288">"OK"</string>
     <string name="label_send_key" msgid="2815056534433717444">"Enviar"</string>
     <string name="label_pause_key" msgid="181098308428035340">"Pausa"</string>
     <string name="label_wait_key" msgid="6402152600878093134">"Esp."</string>
diff --git a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
index 879f1db..165116a 100644
--- a/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
+++ b/java/src/com/android/inputmethod/latin/BinaryDictionaryFileDumper.java
@@ -23,6 +23,7 @@
 import android.content.res.AssetFileDescriptor;
 import android.database.Cursor;
 import android.net.Uri;
+import android.os.RemoteException;
 import android.text.TextUtils;
 import android.util.Log;
 
@@ -95,23 +96,6 @@
     }
 
     /**
-     * Finds out whether the dictionary pack is available on this device.
-     * @param context A context to get the content resolver.
-     * @return whether the dictionary pack is present or not.
-     */
-    private static boolean isDictionaryPackPresent(final Context context) {
-        final ContentResolver cr = context.getContentResolver();
-        final ContentProviderClient client =
-                cr.acquireContentProviderClient(getProviderUriBuilder("").build());
-        if (client != null) {
-            client.release();
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    /**
      * Queries a content provider for the list of word lists for a specific locale
      * available to copy into Latin IME.
      */
@@ -128,15 +112,14 @@
         }
         final Uri dictionaryPackUri = builder.build();
 
-        final ContentResolver resolver = context.getContentResolver();
+        final ContentProviderClient client = context.getContentResolver().
+                acquireContentProviderClient(getProviderUriBuilder("").build());
+        if (null == client) return Collections.<WordListInfo>emptyList();
         try {
-            final Cursor c = resolver.query(dictionaryPackUri, DICTIONARY_PROJECTION, null, null,
+            final Cursor c = client.query(dictionaryPackUri, DICTIONARY_PROJECTION, null, null,
                     null);
             if (null == c) {
-                if (isDictionaryPackPresent(context)) {
-                    reinitializeClientRecordInDictionaryContentProvider(context, resolver,
-                            clientId);
-                }
+                reinitializeClientRecordInDictionaryContentProvider(context, client, clientId);
                 return Collections.<WordListInfo>emptyList();
             }
             if (c.getCount() <= 0 || !c.moveToFirst()) {
@@ -152,21 +135,20 @@
             } while (c.moveToNext());
             c.close();
             return list;
-        } catch (IllegalArgumentException e) {
-            // Any method call on the content resolver may unexpectedly crash without notice
-            // if the content provider is not present (for example, while crypting a device).
-            // Testing seems to indicate that ContentResolver#query() merely returns null
-            // while ContentResolver#delete throws IllegalArgumentException but this is
-            // undocumented, so all ContentResolver methods should be protected. A crash here is
-            // dangerous because crashing here would brick any encrypted device - we need the
-            // keyboard to be up and working to enter the password. So let's be as safe as possible.
-            Log.e(TAG, "IllegalArgumentException: the dictionary pack can't be contacted?", e);
+        } catch (RemoteException e) {
+            // The documentation is unclear as to in which cases this may happen, but it probably
+            // happens when the content provider got suddenly killed because it crashed or because
+            // the user disabled it through Settings.
+            Log.e(TAG, "RemoteException: communication with the dictionary pack cut", e);
             return Collections.<WordListInfo>emptyList();
         } catch (Exception e) {
-            // Just in case we hit a problem in communication with the dictionary pack.
-            // We don't want to die.
-            Log.e(TAG, "Exception communicating with the dictionary pack", e);
+            // A crash here is dangerous because crashing here would brick any encrypted device -
+            // we need the keyboard to be up and working to enter the password, so we don't want
+            // to die no matter what. So let's be as safe as possible.
+            Log.e(TAG, "Unexpected exception communicating with the dictionary pack", e);
             return Collections.<WordListInfo>emptyList();
+        } finally {
+            client.release();
         }
     }
 
@@ -380,7 +362,7 @@
     }
 
     private static void reinitializeClientRecordInDictionaryContentProvider(final Context context,
-            final ContentResolver resolver, final String clientId) {
+            final ContentProviderClient client, final String clientId) throws RemoteException {
         final String metadataFileUri = context.getString(R.string.dictionary_pack_metadata_uri);
         if (TextUtils.isEmpty(metadataFileUri)) return;
         // Tell the content provider to reset all information about this client id
@@ -388,12 +370,12 @@
                 .appendPath(QUERY_PATH_METADATA)
                 .appendQueryParameter(QUERY_PARAMETER_PROTOCOL, QUERY_PARAMETER_PROTOCOL_VALUE)
                 .build();
-        resolver.delete(metadataContentUri, null, null);
+        client.delete(metadataContentUri, null, null);
         // Update the metadata URI
         final ContentValues metadataValues = new ContentValues();
         metadataValues.put(INSERT_METADATA_CLIENT_ID_COLUMN, clientId);
         metadataValues.put(INSERT_METADATA_METADATA_URI_COLUMN, metadataFileUri);
-        resolver.insert(metadataContentUri, metadataValues);
+        client.insert(metadataContentUri, metadataValues);
 
         // Update the dictionary list.
         final Uri dictionaryContentUriBase = getProviderUriBuilder(clientId)
@@ -405,7 +387,7 @@
         final int length = dictionaryList.size();
         for (int i = 0; i < length; ++i) {
             final DictionaryInfo info = dictionaryList.get(i);
-            resolver.insert(Uri.withAppendedPath(dictionaryContentUriBase, info.mId),
+            client.insert(Uri.withAppendedPath(dictionaryContentUriBase, info.mId),
                     info.toContentValues());
         }
     }
diff --git a/java/src/com/android/inputmethod/latin/setup/SetupActivity.java b/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
new file mode 100644
index 0000000..fab8945
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.inputmethod.latin.setup;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+
+import com.android.inputmethod.latin.SettingsActivity;
+
+public final class SetupActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // TODO: Implement setup wizard.
+        final Intent intent = new Intent();
+        intent.setClass(this, SettingsActivity.class);
+        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
+                | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+        startActivity(intent);
+        finish();
+    }
+}
diff --git a/java/src/com/android/inputmethod/research/LogStatement.java b/java/src/com/android/inputmethod/research/LogStatement.java
index 059146a..09b12fc 100644
--- a/java/src/com/android/inputmethod/research/LogStatement.java
+++ b/java/src/com/android/inputmethod/research/LogStatement.java
@@ -35,7 +35,7 @@
  * associated with the {@code String[] keys} are likely to reveal information about the user.  The
  * actual values are stored separately.
  */
-class LogStatement {
+public class LogStatement {
     private static final String TAG = LogStatement.class.getSimpleName();
     private static final boolean DEBUG = false && ProductionFlag.IS_EXPERIMENTAL_DEBUG;
 
@@ -166,6 +166,8 @@
     /**
      * Write the contents out through jsonWriter.
      *
+     * The JsonWriter class must have already had {@code JsonWriter.beginArray} called on it.
+     *
      * Note that this method is not thread safe for the same jsonWriter.  Callers must ensure
      * thread safety.
      */
diff --git a/java/src/com/android/inputmethod/research/LogUnit.java b/java/src/com/android/inputmethod/research/LogUnit.java
index a584a3a..1a9a720 100644
--- a/java/src/com/android/inputmethod/research/LogUnit.java
+++ b/java/src/com/android/inputmethod/research/LogUnit.java
@@ -110,7 +110,13 @@
     }
 
     /**
-     * Publish the contents of this LogUnit to researchLog.
+     * Publish the contents of this LogUnit to {@code researchLog}.
+     *
+     * For each publishable {@code LogStatement}, invoke {@link LogStatement#outputToLocked}.
+     *
+     * @param researchLog where to publish the contents of this {@code LogUnit}
+     * @param canIncludePrivateData whether the private data in this {@code LogUnit} should be
+     * included
      */
     public synchronized void publishTo(final ResearchLog researchLog,
             final boolean canIncludePrivateData) {
diff --git a/java/src/com/android/inputmethod/research/ResearchLog.java b/java/src/com/android/inputmethod/research/ResearchLog.java
index 24bf7d1..5114977 100644
--- a/java/src/com/android/inputmethod/research/ResearchLog.java
+++ b/java/src/com/android/inputmethod/research/ResearchLog.java
@@ -81,10 +81,7 @@
         }
     }
 
-    public ResearchLog(final File outputFile, Context context) {
-        if (outputFile == null) {
-            throw new IllegalArgumentException();
-        }
+    public ResearchLog(final File outputFile, final Context context) {
         mExecutor = Executors.newSingleThreadScheduledExecutor();
         mFile = outputFile;
         mContext = context;
@@ -112,7 +109,7 @@
                     Log.d(TAG, "error when closing ResearchLog:");
                     e.printStackTrace();
                 } finally {
-                    if (mFile.exists()) {
+                    if (mFile != null && mFile.exists()) {
                         mFile.setWritable(false, false);
                     }
                     if (onClosed != null) {
@@ -139,7 +136,9 @@
                         mHasWrittenData = false;
                     }
                 } finally {
-                    mIsAbortSuccessful = mFile.delete();
+                    if (mFile != null) {
+                        mIsAbortSuccessful = mFile.delete();
+                    }
                 }
                 return null;
             }
@@ -209,7 +208,7 @@
      */
     public JsonWriter getValidJsonWriterLocked() {
         try {
-            if (mJsonWriter == NULL_JSON_WRITER) {
+            if (mJsonWriter == NULL_JSON_WRITER && mFile != null) {
                 final FileOutputStream fos =
                         mContext.openFileOutput(mFile.getName(), Context.MODE_PRIVATE);
                 mJsonWriter = new JsonWriter(new BufferedWriter(new OutputStreamWriter(fos)));
diff --git a/native/jni/src/proximity_info.h b/native/jni/src/proximity_info.h
index ee79367..22bbdf1 100644
--- a/native/jni/src/proximity_info.h
+++ b/native/jni/src/proximity_info.h
@@ -70,15 +70,16 @@
     int getKeyCenterYOfKeyIdG(int keyId) const;
     int getKeyKeyDistanceG(int keyId0, int keyId1) const;
 
-    void initializeProximities(const int *const inputCodes, const int *const inputXCoordinates,
-            const int *const inputYCoordinates, const int inputSize, int *allInputCodes) const {
+    void AK_FORCE_INLINE initializeProximities(const int *const inputCodes,
+            const int *const inputXCoordinates, const int *const inputYCoordinates,
+            const int inputSize, int *allInputCodes) const {
         ProximityInfoUtils::initializeProximities(inputCodes, inputXCoordinates, inputYCoordinates,
                 inputSize, mKeyXCoordinates, mKeyYCoordinates, mKeyWidths, mKeyHeights,
                 mProximityCharsArray, CELL_HEIGHT, CELL_WIDTH, GRID_WIDTH, MOST_COMMON_KEY_WIDTH,
                 KEY_COUNT, mLocaleStr, &mCodeToKeyMap, allInputCodes);
     }
 
-    int getKeyIndexOf(const int c) const {
+    int AK_FORCE_INLINE getKeyIndexOf(const int c) const {
         return ProximityInfoUtils::getKeyIndexOf(KEY_COUNT, c, &mCodeToKeyMap);
     }
 
diff --git a/native/jni/src/proximity_info_params.cpp b/native/jni/src/proximity_info_params.cpp
index 1410ab5..f9a4352 100644
--- a/native/jni/src/proximity_info_params.cpp
+++ b/native/jni/src/proximity_info_params.cpp
@@ -88,7 +88,7 @@
 // Used by ProximityInfoStateUtils::getMostProbableString()
 const float ProximityInfoParams::DEMOTION_LOG_PROBABILITY = 0.3f;
 
-// Used by ProximityInfoStateUtils::updateSampledSearchKeysVector()
+// Used by ProximityInfoStateUtils::updateSampledSearchKeySets()
 // TODO: Investigate if this is required
 const float ProximityInfoParams::SEARCH_KEY_RADIUS_RATIO = 0.95f;
 
diff --git a/native/jni/src/proximity_info_params.h b/native/jni/src/proximity_info_params.h
index 7c26208..e7aec09 100644
--- a/native/jni/src/proximity_info_params.h
+++ b/native/jni/src/proximity_info_params.h
@@ -90,7 +90,7 @@
     // Used by ProximityInfoStateUtils::getMostProbableString()
     static const float DEMOTION_LOG_PROBABILITY;
 
-    // Used by ProximityInfoStateUtils::updateSampledSearchKeysVector()
+    // Used by ProximityInfoStateUtils::updateSampledSearchKeySets()
     static const float SEARCH_KEY_RADIUS_RATIO;
 
     // Used by ProximityInfoStateUtils::calculateBeelineSpeedRate()
diff --git a/native/jni/src/proximity_info_state.cpp b/native/jni/src/proximity_info_state.cpp
index 4c1ffb3..bdbf8b1 100644
--- a/native/jni/src/proximity_info_state.cpp
+++ b/native/jni/src/proximity_info_state.cpp
@@ -16,6 +16,7 @@
 
 #include <cstring> // for memset() and memcpy()
 #include <sstream> // for debug prints
+#include <vector>
 
 #define LOG_TAG "LatinIME: proximity_info_state.cpp"
 
@@ -75,8 +76,8 @@
         mSampledInputIndice.clear();
         mSampledLengthCache.clear();
         mSampledDistanceCache_G.clear();
-        mSampledNearKeysVector.clear();
-        mSampledSearchKeysVector.clear();
+        mSampledNearKeySets.clear();
+        mSampledSearchKeySets.clear();
         mSpeedRates.clear();
         mBeelineSpeedPercentiles.clear();
         mCharProbabilities.clear();
@@ -109,7 +110,7 @@
 
     if (mSampledInputSize > 0) {
         ProximityInfoStateUtils::initGeometricDistanceInfos(mProximityInfo, mSampledInputSize,
-                lastSavedInputSize, &mSampledInputXs, &mSampledInputYs, &mSampledNearKeysVector,
+                lastSavedInputSize, &mSampledInputXs, &mSampledInputYs, &mSampledNearKeySets,
                 &mSampledDistanceCache_G);
         if (isGeometric) {
             // updates probabilities of skipping or mapping each key for all points.
@@ -117,10 +118,11 @@
                     mMaxPointToKeyLength, mProximityInfo->getMostCommonKeyWidth(),
                     mProximityInfo->getKeyCount(), lastSavedInputSize, mSampledInputSize,
                     &mSampledInputXs, &mSampledInputYs, &mSpeedRates, &mSampledLengthCache,
-                    &mSampledDistanceCache_G, &mSampledNearKeysVector, &mCharProbabilities);
-            ProximityInfoStateUtils::updateSampledSearchKeysVector(mProximityInfo,
+                    &mSampledDistanceCache_G, &mSampledNearKeySets, &mCharProbabilities);
+            ProximityInfoStateUtils::updateSampledSearchKeySets(mProximityInfo,
                     mSampledInputSize, lastSavedInputSize, &mSampledLengthCache,
-                    &mSampledNearKeysVector, &mSampledSearchKeysVector);
+                    &mSampledNearKeySets, &mSampledSearchKeySets,
+                    &mSampledSearchKeyVectors);
             mMostProbableStringProbability = ProximityInfoStateUtils::getMostProbableString(
                     mProximityInfo, mSampledInputSize, &mCharProbabilities, mMostProbableString);
 
@@ -245,36 +247,9 @@
     return UNRELATED_CHAR;
 }
 
-// Puts possible characters into filter and returns new filter size.
-int ProximityInfoState::getAllPossibleChars(
-        const size_t index, int *const filter, const int filterSize) const {
-    if (index >= mSampledInputXs.size()) {
-        return filterSize;
-    }
-    int newFilterSize = filterSize;
-    const int keyCount = mProximityInfo->getKeyCount();
-    for (int j = 0; j < keyCount; ++j) {
-        if (mSampledSearchKeysVector[index].test(j)) {
-            const int keyCodePoint = mProximityInfo->getCodePointOf(j);
-            bool insert = true;
-            // TODO: Avoid linear search
-            for (int k = 0; k < filterSize; ++k) {
-                if (filter[k] == keyCodePoint) {
-                    insert = false;
-                    break;
-                }
-            }
-            if (insert) {
-                filter[newFilterSize++] = keyCodePoint;
-            }
-        }
-    }
-    return newFilterSize;
-}
-
 bool ProximityInfoState::isKeyInSerchKeysAfterIndex(const int index, const int keyId) const {
     ASSERT(keyId >= 0 && index >= 0 && index < mSampledInputSize);
-    return mSampledSearchKeysVector[index].test(keyId);
+    return mSampledSearchKeySets[index].test(keyId);
 }
 
 float ProximityInfoState::getDirection(const int index0, const int index1) const {
diff --git a/native/jni/src/proximity_info_state.h b/native/jni/src/proximity_info_state.h
index 0386450..c4cbd58 100644
--- a/native/jni/src/proximity_info_state.h
+++ b/native/jni/src/proximity_info_state.h
@@ -50,7 +50,7 @@
               mIsContinuationPossible(false), mSampledInputXs(), mSampledInputYs(), mSampledTimes(),
               mSampledInputIndice(), mSampledLengthCache(), mBeelineSpeedPercentiles(),
               mSampledDistanceCache_G(), mSpeedRates(), mDirections(), mCharProbabilities(),
-              mSampledNearKeysVector(), mSampledSearchKeysVector(),
+              mSampledNearKeySets(), mSampledSearchKeySets(), mSampledSearchKeyVectors(),
               mTouchPositionCorrectionEnabled(false), mSampledInputSize(0),
               mMostProbableStringProbability(0.0f) {
         memset(mInputProximities, 0, sizeof(mInputProximities));
@@ -155,7 +155,9 @@
     ProximityType getMatchedProximityId(const int index, const int c,
             const bool checkProximityChars, int *proximityIndex = 0) const;
 
-    int getAllPossibleChars(const size_t startIndex, int *const filter, const int filterSize) const;
+    const std::vector<int> *getSearchKeyVector(const int index) const {
+        return &mSampledSearchKeyVectors[index];
+    }
 
     float getSpeedRate(const int index) const {
         return mSpeedRates[index];
@@ -236,13 +238,14 @@
     std::vector<hash_map_compat<int, float> > mCharProbabilities;
     // The vector for the key code set which holds nearby keys for each sampled input point
     // 1. Used to calculate the probability of the key
-    // 2. Used to calculate mSampledSearchKeysVector
-    std::vector<ProximityInfoStateUtils::NearKeycodesSet> mSampledNearKeysVector;
+    // 2. Used to calculate mSampledSearchKeySets
+    std::vector<ProximityInfoStateUtils::NearKeycodesSet> mSampledNearKeySets;
     // The vector for the key code set which holds nearby keys of some trailing sampled input points
     // for each sampled input point. These nearby keys contain the next characters which can be in
     // the dictionary. Specifically, currently we are looking for keys nearby trailing sampled
     // inputs including the current input point.
-    std::vector<ProximityInfoStateUtils::NearKeycodesSet> mSampledSearchKeysVector;
+    std::vector<ProximityInfoStateUtils::NearKeycodesSet> mSampledSearchKeySets;
+    std::vector<std::vector<int> > mSampledSearchKeyVectors;
     bool mTouchPositionCorrectionEnabled;
     int mInputProximities[MAX_PROXIMITY_CHARS_SIZE * MAX_WORD_LENGTH];
     int mNormalizedSquaredDistances[MAX_PROXIMITY_CHARS_SIZE * MAX_WORD_LENGTH];
diff --git a/native/jni/src/proximity_info_state_utils.cpp b/native/jni/src/proximity_info_state_utils.cpp
index f9b69d2..2bf327f 100644
--- a/native/jni/src/proximity_info_state_utils.cpp
+++ b/native/jni/src/proximity_info_state_utils.cpp
@@ -224,13 +224,13 @@
         const ProximityInfo *const proximityInfo, const int sampledInputSize,
         const int lastSavedInputSize, const std::vector<int> *const sampledInputXs,
         const std::vector<int> *const sampledInputYs,
-        std::vector<NearKeycodesSet> *SampledNearKeysVector,
+        std::vector<NearKeycodesSet> *SampledNearKeySets,
         std::vector<float> *SampledDistanceCache_G) {
-    SampledNearKeysVector->resize(sampledInputSize);
+    SampledNearKeySets->resize(sampledInputSize);
     const int keyCount = proximityInfo->getKeyCount();
     SampledDistanceCache_G->resize(sampledInputSize * keyCount);
     for (int i = lastSavedInputSize; i < sampledInputSize; ++i) {
-        (*SampledNearKeysVector)[i].reset();
+        (*SampledNearKeySets)[i].reset();
         for (int k = 0; k < keyCount; ++k) {
             const int index = i * keyCount + k;
             const int x = (*sampledInputXs)[i];
@@ -240,7 +240,7 @@
             (*SampledDistanceCache_G)[index] = normalizedSquaredDistance;
             if (normalizedSquaredDistance
                     < ProximityInfoParams::NEAR_KEY_NORMALIZED_SQUARED_THRESHOLD) {
-                (*SampledNearKeysVector)[i][k] = true;
+                (*SampledNearKeySets)[i][k] = true;
             }
         }
     }
@@ -664,7 +664,7 @@
         const std::vector<float> *const sampledSpeedRates,
         const std::vector<int> *const sampledLengthCache,
         const std::vector<float> *const SampledDistanceCache_G,
-        std::vector<NearKeycodesSet> *SampledNearKeysVector,
+        std::vector<NearKeycodesSet> *SampledNearKeySets,
         std::vector<hash_map_compat<int, float> > *charProbabilities) {
     charProbabilities->resize(sampledInputSize);
     // Calculates probabilities of using a point as a correlated point with the character
@@ -680,7 +680,7 @@
 
         float nearestKeyDistance = static_cast<float>(MAX_POINT_TO_KEY_LENGTH);
         for (int j = 0; j < keyCount; ++j) {
-            if ((*SampledNearKeysVector)[i].test(j)) {
+            if ((*SampledNearKeySets)[i].test(j)) {
                 const float distance = getPointToKeyByIdLength(
                         maxPointToKeyLength, SampledDistanceCache_G, keyCount, i, j);
                 if (distance < nearestKeyDistance) {
@@ -761,7 +761,7 @@
         // Summing up probability densities of all near keys.
         float sumOfProbabilityDensities = 0.0f;
         for (int j = 0; j < keyCount; ++j) {
-            if ((*SampledNearKeysVector)[i].test(j)) {
+            if ((*SampledNearKeySets)[i].test(j)) {
                 float distance = sqrtf(getPointToKeyByIdLength(
                         maxPointToKeyLength, SampledDistanceCache_G, keyCount, i, j));
                 if (i == 0 && i != sampledInputSize - 1) {
@@ -801,7 +801,7 @@
 
         // Split the probability of an input point to keys that are close to the input point.
         for (int j = 0; j < keyCount; ++j) {
-            if ((*SampledNearKeysVector)[i].test(j)) {
+            if ((*SampledNearKeySets)[i].test(j)) {
                 float distance = sqrtf(getPointToKeyByIdLength(
                         maxPointToKeyLength, SampledDistanceCache_G, keyCount, i, j));
                 if (i == 0 && i != sampledInputSize - 1) {
@@ -885,10 +885,10 @@
         for (int j = 0; j < keyCount; ++j) {
             hash_map_compat<int, float>::iterator it = (*charProbabilities)[i].find(j);
             if (it == (*charProbabilities)[i].end()){
-                (*SampledNearKeysVector)[i].reset(j);
+                (*SampledNearKeySets)[i].reset(j);
             } else if(it->second < ProximityInfoParams::MIN_PROBABILITY) {
                 // Erases from near keys vector because it has very low probability.
-                (*SampledNearKeysVector)[i].reset(j);
+                (*SampledNearKeySets)[i].reset(j);
                 (*charProbabilities)[i].erase(j);
             } else {
                 it->second = -logf(it->second);
@@ -898,26 +898,42 @@
     }
 }
 
-/* static */ void ProximityInfoStateUtils::updateSampledSearchKeysVector(
+/* static */ void ProximityInfoStateUtils::updateSampledSearchKeySets(
         const ProximityInfo *const proximityInfo, const int sampledInputSize,
         const int lastSavedInputSize,
         const std::vector<int> *const sampledLengthCache,
-        const std::vector<NearKeycodesSet> *const SampledNearKeysVector,
-        std::vector<NearKeycodesSet> *sampledSearchKeysVector) {
-    sampledSearchKeysVector->resize(sampledInputSize);
+        const std::vector<NearKeycodesSet> *const SampledNearKeySets,
+        std::vector<NearKeycodesSet> *sampledSearchKeySets,
+        std::vector<std::vector<int> > *sampledSearchKeyVectors) {
+    sampledSearchKeySets->resize(sampledInputSize);
+    sampledSearchKeyVectors->resize(sampledInputSize);
     const int readForwordLength = static_cast<int>(
             hypotf(proximityInfo->getKeyboardWidth(), proximityInfo->getKeyboardHeight())
                     * ProximityInfoParams::SEARCH_KEY_RADIUS_RATIO);
     for (int i = 0; i < sampledInputSize; ++i) {
         if (i >= lastSavedInputSize) {
-            (*sampledSearchKeysVector)[i].reset();
+            (*sampledSearchKeySets)[i].reset();
         }
         for (int j = max(i, lastSavedInputSize); j < sampledInputSize; ++j) {
             // TODO: Investigate if this is required. This may not fail.
             if ((*sampledLengthCache)[j] - (*sampledLengthCache)[i] >= readForwordLength) {
                 break;
             }
-            (*sampledSearchKeysVector)[i] |= (*SampledNearKeysVector)[j];
+            (*sampledSearchKeySets)[i] |= (*SampledNearKeySets)[j];
+        }
+    }
+    const int keyCount = proximityInfo->getKeyCount();
+    for (int i = 0; i < sampledInputSize; ++i) {
+        std::vector<int> *searchKeyVector = &(*sampledSearchKeyVectors)[i];
+        searchKeyVector->clear();
+        for (int j = 0; j < keyCount; ++j) {
+            if ((*sampledSearchKeySets)[i].test(j)) {
+                const int keyCodePoint = proximityInfo->getCodePointOf(j);
+                if (std::find(searchKeyVector->begin(), searchKeyVector->end(), keyCodePoint)
+                        == searchKeyVector->end()) {
+                    searchKeyVector->push_back(keyCodePoint);
+                }
+            }
         }
     }
 }
diff --git a/native/jni/src/proximity_info_state_utils.h b/native/jni/src/proximity_info_state_utils.h
index af0acc7..d55730a 100644
--- a/native/jni/src/proximity_info_state_utils.h
+++ b/native/jni/src/proximity_info_state_utils.h
@@ -71,13 +71,14 @@
             const std::vector<float> *const sampledSpeedRates,
             const std::vector<int> *const sampledLengthCache,
             const std::vector<float> *const SampledDistanceCache_G,
-            std::vector<NearKeycodesSet> *SampledNearKeysVector,
+            std::vector<NearKeycodesSet> *SampledNearKeySets,
             std::vector<hash_map_compat<int, float> > *charProbabilities);
-    static void updateSampledSearchKeysVector(const ProximityInfo *const proximityInfo,
+    static void updateSampledSearchKeySets(const ProximityInfo *const proximityInfo,
             const int sampledInputSize, const int lastSavedInputSize,
             const std::vector<int> *const sampledLengthCache,
-            const std::vector<NearKeycodesSet> *const SampledNearKeysVector,
-            std::vector<NearKeycodesSet> *sampledSearchKeysVector);
+            const std::vector<NearKeycodesSet> *const SampledNearKeySets,
+            std::vector<NearKeycodesSet> *sampledSearchKeySets,
+            std::vector<std::vector<int> > *sampledSearchKeyVectors);
     static float getPointToKeyByIdLength(const float maxPointToKeyLength,
             const std::vector<float> *const SampledDistanceCache_G, const int keyCount,
             const int inputIndex, const int keyId, const float scale);
@@ -88,7 +89,7 @@
             const int sampledInputSize, const int lastSavedInputSize,
             const std::vector<int> *const sampledInputXs,
             const std::vector<int> *const sampledInputYs,
-            std::vector<NearKeycodesSet> *SampledNearKeysVector,
+            std::vector<NearKeycodesSet> *SampledNearKeySets,
             std::vector<float> *SampledDistanceCache_G);
     static void initPrimaryInputWord(const int inputSize, const int *const inputProximities,
             int *primaryInputWord);
diff --git a/native/jni/src/proximity_info_utils.h b/native/jni/src/proximity_info_utils.h
index c50df57..51cafba 100644
--- a/native/jni/src/proximity_info_utils.h
+++ b/native/jni/src/proximity_info_utils.h
@@ -28,7 +28,7 @@
 namespace latinime {
 class ProximityInfoUtils {
  public:
-    static int getKeyIndexOf(const int keyCount, const int c,
+    static AK_FORCE_INLINE int getKeyIndexOf(const int keyCount, const int c,
             const hash_map_compat<int, int> *const codeToKeyMap) {
         if (keyCount == 0) {
             // We do not have the coordinate data
@@ -45,7 +45,7 @@
         return NOT_AN_INDEX;
     }
 
-    static void initializeProximities(const int *const inputCodes,
+    static AK_FORCE_INLINE void initializeProximities(const int *const inputCodes,
             const int *const inputXCoordinates, const int *const inputYCoordinates,
             const int inputSize, const int *const keyXCoordinates,
             const int *const keyYCoordinates, const int *const keyWidths, const int *keyHeights,
@@ -151,7 +151,7 @@
         return left < right && top < bottom && x >= left && x < right && y >= top && y < bottom;
     }
 
-    static void calculateProximities(const int *const keyXCoordinates,
+    static AK_FORCE_INLINE void calculateProximities(const int *const keyXCoordinates,
             const int *const keyYCoordinates, const int *const keyWidths, const int *keyHeights,
             const int *const proximityCharsArray, const int cellHeight, const int cellWidth,
             const int gridWidth, const int mostCommonKeyWidth, const int keyCount,
