diff --git a/src/com/android/launcher2/Cling.java b/src/com/android/launcher2/Cling.java
index 4f37cb9..09c5062 100644
--- a/src/com/android/launcher2/Cling.java
+++ b/src/com/android/launcher2/Cling.java
@@ -62,10 +62,6 @@
 
     private Paint mErasePaint;
 
-    private View mWorkspaceDesc1;
-    private View mWorkspaceDesc2;
-    private View mAllAppsDesc;
-
     public Cling(Context context) {
         this(context, null, 0);
     }
@@ -98,10 +94,6 @@
                 r.getDimensionPixelSize(R.dimen.toolbar_button_horizontal_padding);
             mButtonBarHeight = r.getDimensionPixelSize(R.dimen.button_bar_height);
 
-            mWorkspaceDesc1 = findViewById(R.id.workspace_cling_move_item);
-            mWorkspaceDesc2 = findViewById(R.id.workspace_cling_open_all_apps);
-            mAllAppsDesc = findViewById(R.id.all_apps_cling_add_item);
-
             mErasePaint = new Paint();
             mErasePaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
             mErasePaint.setColor(0xFFFFFF);
@@ -140,11 +132,6 @@
             double diff = Math.sqrt(Math.pow(event.getX() - pos[0], 2) +
                     Math.pow(event.getY() - pos[1], 2));
             if (diff < mRevealRadius) {
-                if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT)) {
-                    // Do nothing
-                } else if (mDrawIdentifier.equals(ALLAPPS_PORTRAIT)) {
-                    // Do nothing
-                }
                 return false;
             }
         } else if (mDrawIdentifier.equals(FOLDER_PORTRAIT) ||
@@ -167,7 +154,7 @@
             DisplayMetrics metrics = new DisplayMetrics();
             mLauncher.getWindowManager().getDefaultDisplay().getMetrics(metrics);
 
-            // Draw the background
+            // Initialize the draw buffer (to allow punching through)
             Bitmap b = Bitmap.createBitmap(getMeasuredWidth(), getMeasuredHeight(),
                     Bitmap.Config.ARGB_8888);
             Canvas c = new Canvas(b);
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 318601d..3c2c3da 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -77,10 +77,10 @@
 import android.view.View;
 import android.view.View.OnLongClickListener;
 import android.view.ViewGroup;
+import android.view.ViewParent;
 import android.view.WindowManager;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.animation.AccelerateDecelerateInterpolator;
-import android.view.animation.AccelerateInterpolator;
 import android.view.animation.DecelerateInterpolator;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.Advanceable;
@@ -3130,41 +3130,56 @@
             anim.start();
         }
     }
+    private void removeCling(int id) {
+        final View cling = findViewById(id);
+        if (cling != null) {
+            final ViewGroup parent = (ViewGroup) cling.getParent();
+            parent.post(new Runnable() {
+                @Override
+                public void run() {
+                    parent.removeView(cling);
+                }
+            });
+        }
+    }
     public void showFirstRunWorkspaceCling() {
-        if (!isClingsEnabled()) return;
-
         // Enable the clings only if they have not been dismissed before
         SharedPreferences prefs =
             getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
-        if (!prefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) {
+        if (isClingsEnabled() && !prefs.getBoolean(Cling.WORKSPACE_CLING_DISMISSED_KEY, false)) {
             initCling(R.id.workspace_cling, null, false, 0);
+        } else {
+            removeCling(R.id.workspace_cling);
         }
     }
     public void showFirstRunAllAppsCling(int[] position) {
-        if (!isClingsEnabled()) return;
-
         // Enable the clings only if they have not been dismissed before
         SharedPreferences prefs =
             getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
-        if (!prefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) {
+        if (isClingsEnabled() && !prefs.getBoolean(Cling.ALLAPPS_CLING_DISMISSED_KEY, false)) {
             initCling(R.id.all_apps_cling, position, true, 0);
+        } else {
+            removeCling(R.id.all_apps_cling);
         }
     }
     public Cling showFirstRunFoldersCling() {
-        if (!isClingsEnabled()) return null;
-
         // Enable the clings only if they have not been dismissed before
         SharedPreferences prefs =
             getSharedPreferences(PREFS_KEY, Context.MODE_PRIVATE);
         Cling cling = null;
-        if (!prefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) {
+        if (isClingsEnabled() && !prefs.getBoolean(Cling.FOLDER_CLING_DISMISSED_KEY, false)) {
             cling = initCling(R.id.folder_cling, null, true, 0);
+        } else {
+            removeCling(R.id.folder_cling);
         }
         return cling;
     }
     public boolean isFolderClingVisible() {
         Cling cling = (Cling) findViewById(R.id.folder_cling);
-        return cling.getVisibility() == View.VISIBLE;
+        if (cling != null) {
+            return cling.getVisibility() == View.VISIBLE;
+        }
+        return false;
     }
     public void dismissWorkspaceCling(View v) {
         Cling cling = (Cling) findViewById(R.id.workspace_cling);
