 class AppViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
     
     let api_key = "hkn96husrzd5gp824dkcteqc"
+    var current_page = 1
+    var numResults = 0
     var movies: NSArray = NSArray()
+    var refreshControl: UIRefreshControl! = UIRefreshControl()
     
     @IBOutlet weak var tableView: UITableView!
     @IBOutlet weak var networkErrorView: UIView!

    }
    
    func getPopularRentalMovies() {
        let RottenTomatoesURLString = "http://api.rottentomatoes.com/api/public/v1.0/lists/dvds/top_rentals.json?apikey=" + api_key
        let request = NSMutableURLRequest(URL: NSURL(string: RottenTomatoesURLString)!)
        NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue(), completionHandler:{ (response, data, error) in
            var actualError: NSError? = error

        navigationController!.navigationBar.titleTextAttributes = NSDictionary(objectsAndKeys:
            UIColor.yellowColor(), NSForegroundColorAttributeName)
        
        self.refreshControl.attributedTitle = NSAttributedString(string: "Pull to refersh")
        self.refreshControl.addTarget(self, action: Selector("refresh"), forControlEvents: UIControlEvents.ValueChanged)
        self.tableView.addSubview(refreshControl)

        SVProgressHUD.show()
        getPopularRentalMovies()
        SVProgressHUD.dismiss()
    }

    override func didReceiveMemoryWarning() {
