diff --git a/res/layout/user_folder.xml b/res/layout/user_folder.xml
index 299095d..548a39e 100644
--- a/res/layout/user_folder.xml
+++ b/res/layout/user_folder.xml
@@ -49,7 +49,7 @@
         android:paddingTop="@dimen/folder_content_name_gap"
         android:paddingBottom="@dimen/folder_padding"
         android:background="#00000000"
-        android:hint="@string/default_folder_name"
+        android:hint="@string/folder_hint_text"
         android:textSize="16sp"
         android:textColor="#FFF"
         android:gravity="center_horizontal"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d0e4749..2d41791 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -244,5 +244,5 @@
     <string name="dream_name">Rocket Launcher</string>
 
     <!-- Default folder title -->
-    <string name="default_folder_name">Unnamed Folder</string>
+    <string name="folder_hint_text">Unnamed Folder</string>
 </resources>
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 8182b82..68e9edb 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -573,10 +573,6 @@
         }
     }
 
-    public boolean getAcceptsDrops() {
-        return mAcceptsDrops;
-    }
-
     @Override
     public void removeAllViews() {
         clearOccupiedCells();
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index 0454430..c1580b1 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -99,12 +99,14 @@
     private Alarm mOnExitAlarm = new Alarm();
     private TextView mFolderName;
     private int mFolderNameHeight;
-    private static String sDefaultFolderName;
     private Rect mHitRect = new Rect();
 
     private boolean mIsEditingName = false;
     private InputMethodManager mInputMethodManager;
 
+    private static String sDefaultFolderName;
+    private static String sHintText;
+
     /**
      * Used to inflate the Workspace from XML.
      *
@@ -128,6 +130,9 @@
         if (sDefaultFolderName == null) {
             sDefaultFolderName = res.getString(R.string.folder_name);
         }
+        if (sHintText == null) {
+            sHintText = res.getString(R.string.folder_hint_text);
+        }
     }
 
     @Override
@@ -229,6 +234,7 @@
     }
 
     public void startEditingFolderName() {
+        mFolderName.setHint("");
         mFolderName.setCursorVisible(true);
         mIsEditingName = true;
     }
@@ -239,6 +245,7 @@
     }
 
     public void doneEditingFolderName(boolean commit) {
+        mFolderName.setHint(sHintText);
         mInfo.setTitle(mFolderName.getText());
         LauncherModel.updateItemInDatabase(mLauncher, mInfo);
         mFolderName.setCursorVisible(false);
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 7fa96fb..a4e162f 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1417,9 +1417,6 @@
         }
         // Stop any scrolling, move to the current page right away
         setCurrentPage((mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage);
-        if (!mIsDragInProcess) {
-            updateWhichPagesAcceptDrops(shrinkState);
-        }
 
         // Hide the scrollbar
         hideScrollingIndicator(true);
@@ -1701,46 +1698,6 @@
     private final ZoomOutInterpolator mZoomOutInterpolator = new ZoomOutInterpolator();
     private final ZoomInInterpolator mZoomInInterpolator = new ZoomInInterpolator();
 
-    private void updateWhichPagesAcceptDrops(ShrinkState state) {
-        updateWhichPagesAcceptDropsHelper(state, false, 1, 1);
-    }
-
-    private void updateWhichPagesAcceptDropsDuringDrag(ShrinkState state, int spanX, int spanY) {
-        updateWhichPagesAcceptDropsHelper(state, true, spanX, spanY);
-    }
-
-    private void updateWhichPagesAcceptDropsHelper(
-            ShrinkState state, boolean isDragHappening, int spanX, int spanY) {
-        final int screenCount = getChildCount();
-        for (int i = 0; i < screenCount; i++) {
-            CellLayout cl = (CellLayout) getChildAt(i);
-            cl.setIsDragOccuring(isDragHappening);
-            if (state == null) {
-                // If we are not in a shrunken state, mark all cell layouts as droppable (if they
-                // have the space)
-                cl.setAcceptsDrops(cl.findCellForSpan(null, spanX, spanY));
-            } else {
-                switch (state) {
-                    case BOTTOM_HIDDEN:
-                    case BOTTOM_VISIBLE:
-                    case SPRING_LOADED:
-                        cl.setIsDefaultDropTarget(false);
-                        if (!isDragHappening) {
-                            // even if a drag isn't happening, we don't want to show a screen as
-                            // accepting drops if it doesn't have at least one free cell
-                            spanX = 1;
-                            spanY = 1;
-                        }
-                        // the page accepts drops if we can find at least one empty spot
-                        cl.setAcceptsDrops(cl.findCellForSpan(null, spanX, spanY));
-                        break;
-                    default:
-                         throw new RuntimeException("Unhandled ShrinkState " + state);
-                }
-            }
-        }
-    }
-
     /*
     *
     * We call these methods (onDragStartedWithItemSpans/onDragStartedWithSize) whenever we
@@ -1776,8 +1733,6 @@
 
         // The outline is used to visualize where the item will land if dropped
         mDragOutline = createDragOutline(b, canvas, bitmapPadding, size[0], size[1]);
-
-        updateWhichPagesAcceptDropsDuringDrag(mShrinkState, spanX, spanY);
     }
 
     // we call this method whenever a drag and drop in Launcher finishes, even if Workspace was
@@ -1789,7 +1744,6 @@
             doDragExit(null);
         }
         mIsDragInProcess = false;
-        updateWhichPagesAcceptDrops(mShrinkState);
     }
 
     // We call this when we trigger an unshrink by clicking on the CellLayout cl
@@ -2308,18 +2262,31 @@
      * {@inheritDoc}
      */
     public boolean acceptDrop(DragObject d) {
-
         // If it's an external drop (e.g. from All Apps), check if it should be accepted
         if (d.dragSource != this) {
             // Don't accept the drop if we're not over a screen at time of drop
-            if (mDragTargetLayout == null || !mDragTargetLayout.getAcceptsDrops()) {
+            if (mDragTargetLayout == null) {
                 return false;
             }
 
+            mDragViewVisualCenter = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset,
+                    d.dragView, mDragViewVisualCenter);
+
             final CellLayout.CellInfo dragCellInfo = mDragInfo;
             final int spanX = dragCellInfo == null ? 1 : dragCellInfo.spanX;
             final int spanY = dragCellInfo == null ? 1 : dragCellInfo.spanY;
 
+            mTargetCell = findNearestArea((int) mDragViewVisualCenter[0],
+                    (int) mDragViewVisualCenter[1], spanX, spanY, mDragTargetLayout, mTargetCell);
+
+            if (willCreateUserFolder((ItemInfo) d.dragInfo, mDragTargetLayout, mTargetCell, true)) {
+                return true;
+            }
+            if (willAddToExistingUserFolder((ItemInfo) d.dragInfo, mDragTargetLayout,
+                    mTargetCell)) {
+                return true;
+            }
+
             final View ignoreView = dragCellInfo == null ? null : dragCellInfo.cell;
 
             // Don't accept the drop if there's no room for the item
@@ -2331,13 +2298,18 @@
         return true;
     }
 
-    boolean willCreateUserFolder(ItemInfo info, View v, int[] targetCell) {
+    boolean willCreateUserFolder(ItemInfo info, CellLayout target, int[] targetCell,
+            boolean considerTimeout) {
+        View dropOverView = target.getChildAt(targetCell[0], targetCell[1]);
+
         boolean hasntMoved = mDragInfo != null
                 && (mDragInfo.cellX == targetCell[0] && mDragInfo.cellY == targetCell[1]);
 
-        if (v == null || hasntMoved) return false;
+        if (dropOverView == null || hasntMoved || (considerTimeout && !mCreateUserFolderOnDrop)) {
+            return false;
+        }
 
-        boolean aboveShortcut = (v.getTag() instanceof ShortcutInfo);
+        boolean aboveShortcut = (dropOverView.getTag() instanceof ShortcutInfo);
         boolean willBecomeShortcut =
                 (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION ||
                 info.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT);
@@ -2345,6 +2317,17 @@
         return (aboveShortcut && willBecomeShortcut);
     }
 
+    boolean willAddToExistingUserFolder(Object dragInfo, CellLayout target, int[] targetCell) {
+        View dropOverView = target.getChildAt(targetCell[0], targetCell[1]);
+        if (dropOverView instanceof FolderIcon) {
+            FolderIcon fi = (FolderIcon) dropOverView;
+            if (fi.acceptDrop(dragInfo)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     boolean createUserFolderIfNecessary(View newView, CellLayout target,
             int[] targetCell, boolean external) {
         View v = target.getChildAt(targetCell[0], targetCell[1]);
@@ -2381,9 +2364,9 @@
         return false;
     }
 
-    boolean addToExistingFolderIfNecessary(View newView, CellLayout target, int[] tagetCell,
+    boolean addToExistingFolderIfNecessary(View newView, CellLayout target, int[] targetCell,
             Object dragInfo, boolean external) {
-        View dropOverView = target.getChildAt(tagetCell[0], tagetCell[1]);
+        View dropOverView = target.getChildAt(targetCell[0], targetCell[1]);
         if (dropOverView instanceof FolderIcon) {
             FolderIcon fi = (FolderIcon) dropOverView;
             if (fi.acceptDrop(dragInfo)) {
@@ -2402,7 +2385,6 @@
     }
 
     public void onDrop(DragObject d) {
-
         mDragViewVisualCenter = getDragViewVisualCenter(d.x, d.y, d.xOffset, d.yOffset, d.dragView,
                 mDragViewVisualCenter);
 
@@ -2902,8 +2884,7 @@
                     // full screen (which is traditionally set to not accept drops) if they want
                     // to get to pages beyond the screen that is full.
                     boolean isInSpringLoadedMode = (mShrinkState == ShrinkState.SPRING_LOADED);
-                    boolean allowDragOver = (mDragTargetLayout != null) &&
-                            (mDragTargetLayout.getAcceptsDrops() || isInSpringLoadedMode);
+                    boolean allowDragOver = (mDragTargetLayout != null);
                     if (allowDragOver) {
                         if (isInSpringLoadedMode) {
                             mSpringLoadedDragController.setAlarm(mDragTargetLayout);
@@ -2948,8 +2929,8 @@
                     final View dragOverView = mDragTargetLayout.getChildAt(mTargetCell[0],
                             mTargetCell[1]);
 
-                    boolean userFolderPending = willCreateUserFolder(info, dragOverView,
-                            mTargetCell);
+                    boolean userFolderPending = willCreateUserFolder(info, mDragTargetLayout,
+                            mTargetCell, false);
                     boolean isOverFolder = dragOverView instanceof FolderIcon;
                     if (dragOverView != mLastDragOverView) {
                         cancelFolderCreation();
