     }
     
     func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
-
+        
         if UIApplication.sharedApplication().statusBarOrientation == UIInterfaceOrientation.Portrait ||
-           UIApplication.sharedApplication().statusBarOrientation == UIInterfaceOrientation.PortraitUpsideDown {
-            return CGSize(width:collectionView.bounds.size.width, height:collectionView.bounds.size.width)
+            UIApplication.sharedApplication().statusBarOrientation == UIInterfaceOrientation.PortraitUpsideDown {
+                
+                return CGSize(width:collectionView.bounds.size.width, height:collectionView.bounds.size.width)
+                
         } else {
-            return CGSize(width:self.tableView.bounds.size.height, height:collectionView.bounds.size.height)
+            
+            return CGSize(width:self.tableView.bounds.size.width, height:collectionView.bounds.size.height)
+
         }
         
     }

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        
        if self.collectionView != nil {
            self.collectionView.reloadData()
        }

    }
    
    // MARK: - UITableViewDataSource

    }
    
    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        
        if indexPath.row == 0 {
            if UIDevice.currentDevice().orientation == UIDeviceOrientation.Portrait || UIDevice.currentDevice().orientation == UIDeviceOrientation.PortraitUpsideDown {
                return tableView.bounds.size.width
