     }
     
     func shakeHead() {
-        var layer = contentView.image.layerWithIdentifier("head")
-        
-        var animation = CABasicAnimation(keyPath: "transform.rotation.z")
+        if let layer = contentView?.image.layerWithIdentifier("head") {
+        
+        let animation = CABasicAnimation(keyPath: "transform.rotation.z")
         animation.duration = 0.25
         animation.autoreverses = true
         animation.repeatCount = 100000;

private struct ImageLoadingOptions {
    var requiresLayeredImageView = false
    var overrideImageSize = CGSizeZero
    var overrideImageRenderScale: CGFloat = 0
    var diskFilenameToLoad: String
    
    init(name: String) {

                    tmpLayer.contentsScale = UIScreen.mainScreen().scale
                    tmpLayer.shouldRasterize = false
                    textLayerForLastTappedLayer = tmpLayer
                    contentView?.layer.addSublayer(textLayerForLastTappedLayer!)
                    /*
                    * mtrubnikov's code for adding a text overlay showing exactly what you tapped*/
                }
