     }
     
     func query(input: String, with token: String) -> Promise<([Artist], [Track], [Album])> {
-        return Promise { fulfill, reject in
-            let artistsResource = artistSearchResource(from: input)! //TODO: refactor
-            let tracksResource = trackSearchResource(from: input)!
-            let albumsResource = albumSearchResource(from: input)!
-            
-            when(fulfilled: fetch(resource: artistsResource, with: token), fetch(resource: tracksResource, with: token), fetch(resource: albumsResource, with: token)).then(execute: { (response) -> Void in
-                fulfill(response)
-            }).catch(execute: { (error) in
-                reject(error)
-            })
+            searchQueue.cancelAllOperations()
+            return Promise { fulfill, reject in
+                let promiseOp = BlockOperation {
+                let artistsResource = self.artistSearchResource(from: input)! //TODO: refactor
+                let tracksResource = self.trackSearchResource(from: input)!
+                let albumsResource = self.albumSearchResource(from: input)!
+                
+                when(fulfilled: self.fetch(resource: artistsResource, with: token), self.fetch(resource: tracksResource, with: token), self.fetch(resource: albumsResource, with: token)).then(execute: { (response) -> Void in
+                    fulfill(response)
+                }).catch(execute: { (error) in
+                    reject(error)
+                })
+            }
+            searchQueue.addOperation(promiseOp)
         }
     }
     

final class ApiClient {
    
    static let sharedInstance = ApiClient()
    
    private init() {}
    
    func getToken() -> Promise<String> {
        return Promise { fulfill, reject in

            } else {
                return String(character)
            }
            }.joined().lowercased()
        return sanitized
    }
    
