             }
             return validResult
         }
-        guard !cancelled else { return }
+        guard !cancelled else { return [] }
 
         // Alias matches
-        results += allEmoji.filter { emoji in
+        results += AllEmojiArray.filter { emoji in
             guard results.indexOf(emoji) == nil else { return false }
 
             var validResult = false

    public func query(searchString: String, completion: ([Emoji] -> Void)) {
        cancelFetches()

        if let emoji = EmojiFetchOperation.emojiDictionary[searchString] {
            dispatch_async(dispatch_get_main_queue()) {
                completion([emoji])
            }
        } else {
            let operation = EmojiFetchOperation(searchString: searchString)

            operation.completionBlock = {

                if operation.cancelled {
                    return;
                }

                dispatch_async(dispatch_get_main_queue()) {
                    completion(operation.results)
                }
            }

            backgroundQueue.addOperation(operation)
        }
    }

    public func cancelFetches() {

    // MARK: - NSOperation

    override func main() {
        if let emoji = AllEmojiDictionary[searchString] {
            // If searchString is an emoji, return emoji as the result
            results = [emoji]
        } else {
            // Otherwise, search emoji list for all emoji whose name, aliases or groups match searchString.
            results = resultsForSearchString(searchString)
        }
    }


    // MARK: - Functions

    private func resultsForSearchString(searchString: String) -> [Emoji] {
        let lowercaseSearchString = searchString.lowercaseString
        guard !cancelled else { return [] }

        var results = [Emoji]()

        // Matches of the full names of the emoji
        results += AllEmojiArray.filter { $0.name.hasPrefix(lowercaseSearchString) }
        guard !cancelled else { return [] }

        // Matches of individual words in the name
        results += AllEmojiArray.filter { emoji in
            guard results.indexOf(emoji) == nil else { return false }

            var validResult = false
