     // MARK: - public methods
     // MARK: -
     // MARK: fetchData methods
-    public func fetchData(var URL url:String, parameters:Dictionary<String, String>?, cachePolicy:HYLNetworkCachePolicy, successHandler:((data:AnyObject?)->Void)?, failureHandler:((error:NSError)->Void)?){
-        if let parameters = parameters {
-            buildURL(originalURL: &url, withQueryDictionary: parameters)
-        }
+    public func fetchData(URL url:String, parameters:Dictionary<String, String>?, cachePolicy:HYLNetworkCachePolicy, successHandler:((data:AnyObject?)->Void)?, failureHandler:((error:NSError)->Void)?){
+        /* build url with query */
+        let urlWithQuery:String = parameters != nil ? URLWithQuery(originalURL: url, withQueryDictionary: parameters!) : url
+        
         /* load cached data according to policy */
-        if let cachedData = fetchCachedData(itemIdentifier: url), successHandler = successHandler where cachePolicy != .LoadWithoutCacheData {
+        if let cachedData = fetchCachedData(itemIdentifier: urlWithQuery), successHandler = successHandler where cachePolicy != .LoadWithoutCacheData {
             successHandler(data: cachedData)
             if cachePolicy == .ReturnCacheDataElseLoad {
                 return

        guard let delegate = self.delegate else { return }
        
        delegate.fetchDataFromNetwork(URL: url,parameters: parameters, successHandler: { (data) -> Void in
            successHandler?(data: data)            
            self.updateCache(itemIdentifier: url, data: data)
        }, failureHandler: { (error) -> Void in
            failureHandler?(error: error)
        })

        return nil
    }
    
    private func URLWithQuery(originalURL url:String, withQueryDictionary parameters:Dictionary<String, String>)->String{
        if let components = NSURLComponents(string: url) {
            components.queryItems = [NSURLQueryItem]()
            for (key, value) in parameters{
                components.queryItems?.append(NSURLQueryItem(name: key, value: value))
            }
            return components.string!
        }
        return url
    }
    // MARK: - Core Data stack
    
