             make.edges.equalTo(self.view)
         }
         self.collection = collection
+        let collectionSize = collection.bounds.size
+        self.layout.setupForOrientation(UIView.viewOrientationForSize(collectionSize), atSize: collectionSize)
         self.refreshHistory(layout.thumbnailCount)
     }
 
-    deinit {
-        NSNotificationCenter.defaultCenter().removeObserver(self, name: NotificationFirefoxAccountChanged, object: nil)
-        NSNotificationCenter.defaultCenter().removeObserver(self, name: NotificationPrivateDataCleared, object: nil)
+    override func viewDidLayoutSubviews() {
+        super.viewDidLayoutSubviews()
+        if let collectionSize = collection?.bounds.size {
+            self.layout.setupForOrientation(UIView.viewOrientationForSize(collectionSize), atSize: collectionSize)
+        }
+    }
+
+    override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
+        super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
+        self.layout.setupForOrientation(UIView.viewOrientationForSize(size), atSize: size)
+        self.refreshHistory(self.layout.thumbnailCount)
+    }
+
+    override func supportedInterfaceOrientations() -> Int {
+        return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue)
     }
     
     func notificationReceived(notification: NSNotification) {


    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func viewDidLoad() {

        } else {
            thumbnailCols = 3
        }
        height = size.height
        width = size.width
    }

    private func getIndexAtPosition(#y: CGFloat) -> Int {
