         if !searchBar.text!.isEmpty {
             searchBar.resignFirstResponder()
         
+            dataTask?.cancel()
             isLoading = true
             tableView.reloadData()
         

    
    var isLoading = false
    
    struct TableViewCellIdentifiers {
        static let searchResultCell = "SearchResultCell"
        static let nothingFoundCell = "NothingFoundCell"

        
            let url = urlWithSearchText(searchBar.text!)
            let session = NSURLSession.sharedSession()
            dataTask = session.dataTaskWithURL(url, completionHandler: {
                (data, response, error)  in
                if let error = error where error.code == -999 {
                    return // Search was cancelled
                } else if let httpResponse = response as? NSHTTPURLResponse where httpResponse.statusCode == 200 {
                    if let data = data, dictionary = self.parseJSON(data) {
                        self.searchResults = self.parseDictionary(dictionary)
