 import Foundation
 
 class SecondHand {
-    private static let refreshUrl = "https://api.sf-f.org.il/yad2/form?formId="
+    private static let refreshUrl = "https://api.sf-f.org.il/yad2/form?formIds="
     private static let fileName = Convention.name + "SecondHand.json";
     private static let cacheFile = NSHomeDirectory() + "/Library/Caches/" + "1_" + fileName;
-
-    // Used to count the number of downloaded forms during refresh
-    private var numRefresh = 0
-    private var totalSuccess = true
     
     var cache = Cache(forms: [], lastRefresh: nil)
     var forms: Array<SecondHand.Form> {

            }
        }
        
        // since there's currently no API to refresh multiple forms, send a request per form
        for form in forms {
            numRefresh = 0
            totalSuccess = true
            
            refresh(formId: form.id, {success in
                // Assumes this callback is invoked on the UI thread, so no need for synctonization
                self.numRefresh += 1
                self.totalSuccess = self.totalSuccess && success
                
                if (self.numRefresh >= self.forms.count) {
                    callback?(self.totalSuccess)
                }
            })
        }
    }
    
    func remove(formId: Int) {

        }
    }
    
    func refresh(formIds: Array<Int>, _ callback: ((Bool) -> Void)?) {
        let formIdsString = formIds
            .map{String($0)}
            .joined(separator: ",")
        
        let url = URL(string: SecondHand.refreshUrl + formIdsString)!
        
        URLSession.shared.dataTask(with: url, completionHandler:{(data, response, error) -> Void in

