             var upperLeftCorner = self.popup!.frame.origin
             var popupPosition = self.superview!.convertPoint(upperLeftCorner, fromView: self) // TODO: hack
             
-            //            if popupPosition.y < 0 {
-            //            if self.popup!.bounds.height < 10 {
-            //                if self.frame.origin.x < self.superview!.bounds.width/2 { // TODO: hack
-            //                    self.popupDirection = Direction.Right
-            //                }
-            //                else {
-            //                    self.popupDirection = Direction.Left
-            //                }
-            //                self.setupPopupConstraints(self.popupDirection)
-            //                self.delegate?.willShowPopup(self, direction: self.popupDirection)
-            //                self.configurePopup(self.popupDirection)
-            //                super.layoutSubviews()
-            //            }
-            
-//            self.createAwesomeBackground()
-        }
-    }
-    
-    //    var shadowAlpha: CGFloat { didSet { self.setNeedsDisplay() }}
-    //    var shadowOffset: CGPoint { didSet { self.setNeedsDisplay() }}
-    //    var shadowBlurRadius: CGFloat { didSet { self.setNeedsDisplay() }}
-    //    shadowAlpha = CGFloat(0.35)
-    //    shadowOffset = CGPointMake(0, 1.5)
-    //    shadowBlurRadius = CGFloat(12)
-    
-    var awesomeBackground: UIView?
-    var awesomeShadow: UIView?
-    func createAwesomeBackground() {
-        return;
-        
-//        self.popup?.hidden = true
-//        self.background.hidden = true
-//        self.connector?.hidden = true
-        
-        self.background.layoutIfNeeded()
-        self.popup?.layoutIfNeeded()
-        self.connector?.layoutIfNeeded()
-        
-        var testPath = UIBezierPath()
-        var edgePath = UIBezierPath()
-        
-        var boundingBox = CGRectUnion(self.bounds, self.popup!.frame)
-        var prettyView = UIVisualEffectView(effect: UIBlurEffect(style: UIBlurEffectStyle.Light))
-//        prettyView.backgroundColor = (self.blurryTemp ? nil : UIColor.yellowColor())
-//        prettyView.backgroundColor = UIColor.whiteColor().colorWithAlphaComponent(CGFloat(0.25))
-        prettyView.contentView.backgroundColor = UIColor.whiteColor().colorWithAlphaComponent(CGFloat(0.25))
-        prettyView.frame = boundingBox
-        
-//        var shadowShapeLayer = CAShapeLayer()
-////        shadowView.layer = shadowShapeLayer
-//        let scalingFactor: CGSize = CGSizeMake(3, 1.5)
-//        var shadowViewFrame = CGRectZero
-////        shadowViewFrame.size = CGSizeMake(boundingBox.width * scalingFactor.width, boundingBox.height * scalingFactor.height)
-////        shadowViewFrame.origin.x = boundingBox.origin.x + ((boundingBox.width - shadowViewFrame.width) / CGFloat(2))
-////        shadowViewFrame.origin.y = boundingBox.origin.y + ((boundingBox.height - shadowViewFrame.height) / CGFloat(2))
-////        shadowView.frame = shadowViewFrame
-////        shadowView.frame = boundingBox
-//        shadowShapeLayer.frame = boundingBox
-//        shadowShapeLayer.opaque = false
-        
-//        shadowView.backgroundColor = UIColor.greenColor()
-        
-        self.awesomeBackground = prettyView
-//        self.awesomeShadow = shadowView
-        
-//        self.addSubview(shadowView)
-//        self.layer.addSublayer(shadowShapeLayer)
-        self.addSubview(prettyView)
-        
-        let unitSquare = CGRectMake(0, 0, 1, 1)
-        
-        var backgroundPath = self.background.fillPath!
-        var translatedUnitSquare = prettyView.convertRect(unitSquare, fromView: self.background)
-        let transformFromBackgroundToView = CGAffineTransformMakeTranslation(translatedUnitSquare.origin.x, translatedUnitSquare.origin.y)
-        backgroundPath.applyTransform(transformFromBackgroundToView)
-        testPath.appendPath(backgroundPath)
-        for (e, anEdgePath) in enumerate(self.background.edgePaths!) {
-            var editablePath = anEdgePath
-            editablePath.applyTransform(transformFromBackgroundToView)
-            edgePath.appendPath(editablePath)
-        }
-        
-        var connectorPath = self.connector!.fillPath!
-        translatedUnitSquare = prettyView.convertRect(unitSquare, fromView: self.connector!)
-        let transformFromConnectorToView = CGAffineTransformMakeTranslation(translatedUnitSquare.origin.x, translatedUnitSquare.origin.y)
-        connectorPath.applyTransform(transformFromConnectorToView)
-        testPath.appendPath(connectorPath)
-        for (e, anEdgePath) in enumerate(self.connector!.edgePaths!) {
-            var editablePath = anEdgePath.copy() as UIBezierPath
-            editablePath.applyTransform(transformFromConnectorToView)
-            edgePath.appendPath(editablePath)
-        }
-        
-        var popupPath = self.popup!.fillPath!
-        translatedUnitSquare = prettyView.convertRect(unitSquare, fromView: self.popup!)
-        let transformFromPopupToView = CGAffineTransformMakeTranslation(translatedUnitSquare.origin.x, translatedUnitSquare.origin.y)
-        popupPath.applyTransform(transformFromPopupToView)
-        testPath.appendPath(popupPath)
-        for (e, anEdgePath) in enumerate(self.popup!.edgePaths!) {
-            var editablePath = anEdgePath
-            editablePath.applyTransform(transformFromPopupToView)
-            edgePath.appendPath(editablePath)
-        }
-
-        // SHADOW
-        
-//        shadowShapeLayer.path = testPath.CGPath
-//        shadowShapeLayer.fillColor = UIColor.redColor().colorWithAlphaComponent(CGFloat(0.25)).CGColor
-//        shadowShapeLayer.shadowColor = UIColor.blackColor().CGColor
-//        shadowShapeLayer.shadowOffset = CGSizeMake(10, 10)
-//        shadowShapeLayer.shadowOpacity = Float(0.75)
-        
-        var shapeLayer1 = CAShapeLayer()
-//        shapeLayer1.fillColor = UIColor.blueColor().CGColor
-//        maskLayer.path = testPath.bezierPathByReversingPath().CGPath
-        var shadowView = UIView()
-//        shapeLayer1.fillColor = UIColor.redColor().CGColor
-        shapeLayer1.shadowOpacity = Float(0.5)
-        shadowView.frame = boundingBox
-//        shadowView.frame.origin.x -= 40
-        shadowView.layer.addSublayer(shapeLayer1)
-        shapeLayer1.shadowRadius = 5
-        shapeLayer1.shadowPath = UIBezierPath(ovalInRect: CGRectMake(2, (shadowView.bounds.height / CGFloat(2)) - CGFloat(10) + CGFloat(5), shadowView.bounds.width - CGFloat(4), 20)).CGPath
-        
-//        shapeLayer1.shadowOpacity = Float(1)
-//        shapeLayer1.mask = maskLayer
-//        shapeLayer1.shadowOffset = CGSizeMake(-20, 20)
-//        shapeLayer1.frame = shadowView.bounds
-//        maskLayer.frame = shadowView.bounds
-        var clipRectPath = UIBezierPath(rect: shadowView.bounds)
-        clipRectPath.appendPath(testPath)
-//        maskLayer.path = clipRectPath.CGPath
-        self.addSubview(shadowView)
-        awesomeShadow = shadowView
-        
-        
-        // UNDERLAY
-        
-        // BG MASK
-        
-        var shapeLayer = CAShapeLayer()
-        shapeLayer.path = testPath.CGPath
-        prettyView.layer.mask = shapeLayer
-//        shadowShapeLayer.removeFromSuperlayer()
-//        shadowShapeLayer.frame.origin = CGPointZero
-//        prettyView.layer.addSublayer(shadowShapeLayer)
-        
-        // BORDER
-        
-        var borderLayer = CAShapeLayer()
-        borderLayer.path = edgePath.CGPath
-        borderLayer.borderWidth = 5
-//        borderLayer.borderColor = UIColor.blueColor().CGColor
-        borderLayer.strokeColor = UIColor.blueColor().CGColor
-        borderLayer.fillColor = UIColor.clearColor().CGColor
-        prettyView.contentView.layer.addSublayer(borderLayer)
-        
-        prettyView.removeFromSuperview()
-        self.addSubview(prettyView)
+            return true
+        }
+        
+        return false
     }
     
     func redrawText() {

                }
            }
        }
        
        addCurves(self.background, testPath, edgePath)
        addCurves(self.connector, testPath, edgePath)
        addCurves(self.popup, testPath, edgePath)

    }
    
    func showPopup() {
        if self.popup == nil {
            self.layer.zPosition = 1000
            
            var popup = KeyboardKeyBackground(blur: withBlur, cornerRadius: 9.0, underOffset: 2)
            self.popup = popup
            self.addSubview(popup)
            
