diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index e99e956..38025e8 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -389,7 +389,7 @@
         }
     }
 
-    public int getManualCapsMode() {
+    public int getKeyboardShiftMode() {
         final Keyboard keyboard = getKeyboard();
         if (keyboard == null) {
             return WordComposer.CAPS_MODE_OFF;
@@ -400,6 +400,8 @@
             return WordComposer.CAPS_MODE_MANUAL_SHIFT_LOCKED;
         case KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED:
             return WordComposer.CAPS_MODE_MANUAL_SHIFTED;
+        case KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED:
+            return WordComposer.CAPS_MODE_AUTO_SHIFTED;
         default:
             return WordComposer.CAPS_MODE_OFF;
         }
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index b39f2ba..472f74b 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -105,7 +105,7 @@
     private static final String TAG = KeyboardView.class.getSimpleName();
 
     // XML attributes
-    private final KeyVisualAttributes mKeyVisualAttributes;
+    protected final KeyVisualAttributes mKeyVisualAttributes;
     private final int mKeyLabelHorizontalPadding;
     private final float mKeyHintLetterPadding;
     private final float mKeyPopupHintLetterPadding;
@@ -733,6 +733,7 @@
         return width;
     }
 
+    // TODO: Remove this method.
     public float getLabelWidth(final String label, final Paint paint) {
         paint.getTextBounds(label, 0, label.length(), mTextBounds);
         return mTextBounds.width();
diff --git a/java/src/com/android/inputmethod/keyboard/PointerTracker.java b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
index f50ab19..92e1f54 100644
--- a/java/src/com/android/inputmethod/keyboard/PointerTracker.java
+++ b/java/src/com/android/inputmethod/keyboard/PointerTracker.java
@@ -180,8 +180,9 @@
 
     static final class BogusMoveEventDetector {
         // Move these thresholds to resource.
-        private static final float BOGUS_MOVE_ACCUMULATED_DISTANCE_THRESHOLD = 0.70f; // in keyWidth
-        private static final float BOGUS_MOVE_RADIUS_THRESHOLD = 1.50f; // in keyWidth
+        // These thresholds' unit is a diagonal length of a key.
+        private static final float BOGUS_MOVE_ACCUMULATED_DISTANCE_THRESHOLD = 0.53f;
+        private static final float BOGUS_MOVE_RADIUS_THRESHOLD = 1.14f;
 
         private int mAccumulatedDistanceThreshold;
         private int mRadiusThreshold;
@@ -191,10 +192,11 @@
         private int mActualDownX;
         private int mActualDownY;
 
-        public void setKeyboardGeometry(final int keyWidth) {
+        public void setKeyboardGeometry(final int keyWidth, final int keyHeight) {
+            final float keyDiagonal = (float)Math.hypot(keyWidth, keyHeight);
             mAccumulatedDistanceThreshold = (int)(
-                    keyWidth * BOGUS_MOVE_ACCUMULATED_DISTANCE_THRESHOLD);
-            mRadiusThreshold = (int)(keyWidth * BOGUS_MOVE_RADIUS_THRESHOLD);
+                    keyDiagonal * BOGUS_MOVE_ACCUMULATED_DISTANCE_THRESHOLD);
+            mRadiusThreshold = (int)(keyDiagonal * BOGUS_MOVE_RADIUS_THRESHOLD);
         }
 
         public void onActualDownEvent(final int x, final int y) {
@@ -210,8 +212,12 @@
             mAccumulatedDistanceFromDownKey += distance;
         }
 
-        public boolean hasTraveledLongDistance() {
-            return mAccumulatedDistanceFromDownKey >= mAccumulatedDistanceThreshold;
+        public boolean hasTraveledLongDistance(final int x, final int y) {
+            final int dx = Math.abs(x - mActualDownX);
+            final int dy = Math.abs(y - mActualDownY);
+            // A bogus move event should be a horizontal movement. A vertical movement might be
+            // a sloppy typing and should be ignored.
+            return dx >= dy && mAccumulatedDistanceFromDownKey >= mAccumulatedDistanceThreshold;
         }
 
         /* package */ int getDistanceFromDownEvent(final int x, final int y) {
@@ -514,7 +520,9 @@
         }
         mKeyDetector = keyDetector;
         mKeyboard = keyDetector.getKeyboard();
-        mGestureStrokeWithPreviewPoints.setKeyboardGeometry(mKeyboard.mMostCommonKeyWidth);
+        final int keyWidth = mKeyboard.mMostCommonKeyWidth;
+        final int keyHeight = mKeyboard.mMostCommonKeyHeight;
+        mGestureStrokeWithPreviewPoints.setKeyboardGeometry(keyWidth);
         final Key newKey = mKeyDetector.detectHitKey(mKeyX, mKeyY);
         if (newKey != mCurrentKey) {
             if (mDrawingProxy != null) {
@@ -522,9 +530,8 @@
             }
             // Keep {@link #mCurrentKey} that comes from previous keyboard.
         }
-        final int keyWidth = mKeyboard.mMostCommonKeyWidth;
         mPhantonSuddenMoveThreshold = (int)(keyWidth * PHANTOM_SUDDEN_MOVE_THRESHOLD);
-        mBogusMoveEventDetector.setKeyboardGeometry(keyWidth);
+        mBogusMoveEventDetector.setKeyboardGeometry(keyWidth, keyHeight);
     }
 
     @Override
@@ -962,11 +969,13 @@
                             && sTimeRecorder.isInFastTyping(eventTime)
                             && mBogusMoveEventDetector.isCloseToActualDownEvent(x, y)) {
                         if (DEBUG_MODE) {
+                            final float keyDiagonal = (float)Math.hypot(
+                                    mKeyboard.mMostCommonKeyWidth, mKeyboard.mMostCommonKeyHeight);
                             final float radiusRatio =
-                                    (float)mBogusMoveEventDetector.getDistanceFromDownEvent(x, y)
-                                    / mKeyboard.mMostCommonKeyWidth;
+                                    mBogusMoveEventDetector.getDistanceFromDownEvent(x, y)
+                                    / keyDiagonal;
                             Log.w(TAG, String.format("[%d] onMoveEvent:"
-                                    + " bogus down-move-up event (raidus=%.2f keyWidth) is "
+                                    + " bogus down-move-up event (raidus=%.2f key diagonal) is "
                                     + " translated to up[%d,%d,%s]/down[%d,%d,%s] events",
                                     mPointerId, radiusRatio,
                                     lastX, lastY, Keyboard.printableCode(oldKey.mCode),
@@ -1146,24 +1155,24 @@
             final int distanceFromKeyEdgeSquared = curKey.squaredDistanceToEdge(x, y);
             if (distanceFromKeyEdgeSquared >= keyHysteresisDistanceSquared) {
                 if (DEBUG_MODE) {
-                    final int keyWidth = mKeyboard.mMostCommonKeyWidth;
-                    final float distanceToEdgeRatio = (float)distanceFromKeyEdgeSquared
-                            / (keyWidth * keyWidth);
+                    final float distanceToEdgeRatio = (float)Math.sqrt(distanceFromKeyEdgeSquared)
+                            / mKeyboard.mMostCommonKeyWidth;
                     Log.d(TAG, String.format("[%d] isMajorEnoughMoveToBeOnNewKey:"
-                            +" %.2f keyWidth from key edge",
+                            +" %.2f key width from key edge",
                             mPointerId, distanceToEdgeRatio));
                 }
                 return true;
             }
             if (sNeedsProximateBogusDownMoveUpEventHack && !mIsAllowedSlidingKeyInput
                     && sTimeRecorder.isInFastTyping(eventTime)
-                    && mBogusMoveEventDetector.hasTraveledLongDistance()) {
+                    && mBogusMoveEventDetector.hasTraveledLongDistance(x, y)) {
                 if (DEBUG_MODE) {
+                    final float keyDiagonal = (float)Math.hypot(
+                            mKeyboard.mMostCommonKeyWidth, mKeyboard.mMostCommonKeyHeight);
                     final float lengthFromDownRatio =
-                            (float)mBogusMoveEventDetector.mAccumulatedDistanceFromDownKey
-                            / mKeyboard.mMostCommonKeyWidth;
+                            mBogusMoveEventDetector.mAccumulatedDistanceFromDownKey / keyDiagonal;
                     Log.d(TAG, String.format("[%d] isMajorEnoughMoveToBeOnNewKey:"
-                            + " %.2f keyWidth from virtual down point",
+                            + " %.2f key diagonal from virtual down point",
                             mPointerId, lengthFromDownRatio));
                 }
                 return true;
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 5a6a502..044d6de 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1119,8 +1119,8 @@
 
     // Factor in auto-caps and manual caps and compute the current caps mode.
     private int getActualCapsMode() {
-        final int manual = mKeyboardSwitcher.getManualCapsMode();
-        if (manual != WordComposer.CAPS_MODE_OFF) return manual;
+        final int keyboardShiftMode = mKeyboardSwitcher.getKeyboardShiftMode();
+        if (keyboardShiftMode != WordComposer.CAPS_MODE_AUTO_SHIFTED) return keyboardShiftMode;
         final int auto = getCurrentAutoCapsState();
         if (0 != (auto & TextUtils.CAP_MODE_CHARACTERS)) {
             return WordComposer.CAPS_MODE_AUTO_SHIFT_LOCKED;
@@ -1429,6 +1429,12 @@
             // The following is necessary for the case where the user typed something but didn't
             // manual pick it and didn't input any separator.
             mSpaceState = SPACE_STATE_PHANTOM;
+        } else {
+            final int codePointBeforeCursor = mConnection.getCodePointBeforeCursor();
+            if (Constants.NOT_A_CODE != codePointBeforeCursor
+                    && !Character.isWhitespace(codePointBeforeCursor)) {
+                mSpaceState = SPACE_STATE_PHANTOM;
+            }
         }
         mConnection.endBatchEdit();
         mWordComposer.setCapitalizedModeAtStartComposingTime(getActualCapsMode());
@@ -1564,6 +1570,7 @@
         // We have a TLD (or something that looks like this): make sure we don't add
         // a space even if currently in phantom mode.
         mSpaceState = SPACE_STATE_NONE;
+        // TODO: use getCodePointBeforeCursor instead to improve performance and simplify the code
         final CharSequence lastOne = mConnection.getTextBeforeCursor(1, 0);
         if (lastOne != null && lastOne.length() == 1
                 && lastOne.charAt(0) == Keyboard.CODE_PERIOD) {
@@ -2280,6 +2287,7 @@
             // This is a stopgap solution to avoid leaving a high surrogate alone in a text view.
             // In the future, we need to deprecate deteleSurroundingText() and have a surrogate
             // pair-friendly way of deleting characters in InputConnection.
+            // TODO: use getCodePointBeforeCursor instead to improve performance
             final CharSequence lastChar = mConnection.getTextBeforeCursor(1, 0);
             if (!TextUtils.isEmpty(lastChar) && Character.isHighSurrogate(lastChar.charAt(0))) {
                 mConnection.deleteSurroundingText(1, 0);
diff --git a/java/src/com/android/inputmethod/latin/RichInputConnection.java b/java/src/com/android/inputmethod/latin/RichInputConnection.java
index b27db57..2144136 100644
--- a/java/src/com/android/inputmethod/latin/RichInputConnection.java
+++ b/java/src/com/android/inputmethod/latin/RichInputConnection.java
@@ -235,7 +235,14 @@
                 hasSpaceBefore);
     }
 
+    public int getCodePointBeforeCursor() {
+        if (mCommittedTextBeforeComposingText.length() < 1) return Constants.NOT_A_CODE;
+        return Character.codePointBefore(mCommittedTextBeforeComposingText,
+                mCommittedTextBeforeComposingText.length());
+    }
+
     public CharSequence getTextBeforeCursor(final int i, final int j) {
+        // TODO: use mCommittedTextBeforeComposingText if possible to improve performance
         mIC = mParent.getCurrentInputConnection();
         if (null != mIC) return mIC.getTextBeforeCursor(i, j);
         return null;
diff --git a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java
index 4ad82ab..4262695 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java
@@ -50,10 +50,11 @@
             super();
         }
 
+        // TODO: Remove {@link MoreSuggestionsView} argument.
         public int layout(final SuggestedWords suggestions, final int fromPos, final int maxWidth,
                 final int minWidth, final int maxRow, final MoreSuggestionsView view) {
             clearKeys();
-            final Resources res = view.getContext().getResources();
+            final Resources res = view.getResources();
             mDivider = res.getDrawable(R.drawable.more_suggestions_divider);
             mDividerWidth = mDivider.getIntrinsicWidth();
             final int padding = (int) res.getDimension(
@@ -180,6 +181,7 @@
             load(xmlId, parentKeyboard.mId);
             mParams.mVerticalGap = mParams.mTopPadding = parentKeyboard.mVerticalGap / 2;
 
+            mPaneView.updateKeyboardGeometry(mParams.mDefaultRowHeight);
             final int count = mParams.layout(suggestions, fromPos, maxWidth, minWidth, maxRow,
                     mPaneView);
             mFromPos = fromPos;
diff --git a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
index 740476f..6cdd9e2 100644
--- a/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
+++ b/java/src/com/android/inputmethod/latin/suggestions/MoreSuggestionsView.java
@@ -106,6 +106,10 @@
         }
     }
 
+    public void updateKeyboardGeometry(final int keyHeight) {
+        mKeyDrawParams.updateParams(keyHeight, mKeyVisualAttributes);
+    }
+
     @Override
     public void setKeyboard(final Keyboard keyboard) {
         super.setKeyboard(keyboard);
