     
     switch atCorner {
     case .LowerLeftCorner:
-      newFrame.origin = CGPoint(x: kButtonOffset, y: screenHeight - kButtonOffset - elementHeight)
+      newFrame.origin = CGPoint(x: 0, y: screenHeight - elementHeight)
     case .LowerRightCorner:
-      newFrame.origin = CGPoint(x: screenWidth - kButtonOffset - elementWidth, y: screenHeight - kButtonOffset - elementHeight)
+      newFrame.origin = CGPoint(x: screenWidth - elementWidth, y: screenHeight - elementHeight)
     case .UpperLeftCorner:
-      newFrame.origin = CGPoint(x: kButtonOffset, y: kButtonOffset)
+      newFrame.origin = CGPoint(x: 0, y: 0)
     case .UpperRightCorner:
-      newFrame.origin = CGPoint(x: screenWidth - kButtonOffset - elementWidth, y: kButtonOffset)
+      newFrame.origin = CGPoint(x: screenWidth - elementWidth, y: 0)
+    }
+    
+    let orientation = UIDevice.currentDevice().orientation
+    switch orientation {
+    case .Portrait:
+      newFrame.origin.y += kButtonOffset
+    case .PortraitUpsideDown:
+      newFrame.origin.y -= kButtonOffset
+    case .LandscapeLeft:
+      newFrame.origin.x -= kButtonOffset
+    default:
+      newFrame.origin.x += kButtonOffset
     }
     
     return newFrame

  let kLeftButtonTag = 1
  let kRightButtonTag = 2
  let kGridViewTag = 3
  let kButtonOffset: CGFloat = 5
  
  var leftButton: UIButton!
  var rightButton: UIButton!

    button.backgroundColor = UIColor(red: 0.803, green: 0.788, blue: 0.788, alpha: 0.5)
    button.addTarget(self, action: "showGrid:", forControlEvents: .TouchUpInside)
    
    return button
  }
  
