                     }
                     
                     if !ngrams_added.contains(insertNgram) {//result! == 0 {
-                        bulk_ngrams_insert.append("(\"\(insertNgram)\",\(insert_n),\(freq)), ")
-                        bulk_containers_insert.append("(\"Default\",\"\(insertNgram)\",\(insert_n),\(freq)), ")
+                        ngrams.append("(\"\(insertNgram)\",\(insert_n),\(freq)), ")
+                        containers.append("(\"Default\",\"\(insertNgram)\",\(insert_n),\(freq)), ")
 
                         ngrams_added.insert(insertNgram)
                     }

                    let frequency:Float64 = Float64(wordComponents[0])!
                    let oneGram = wordComponents[1]
                    
                    bulk_ngrams_insert.append("(\"\(oneGram)\",1,\(frequency)), ")
                    bulk_containers_insert.append("(\"Default\",\"\(oneGram)\",1,\(frequency)), ")

                    ngrams_added.insert(oneGram)


                var ngrams_added = Set<String>()
                var bulk_ngrams_insert = "INSERT INTO Ngrams (gram, n, frequency) VALUES "
                var bulk_containers_insert = "INSERT INTO Containers (profile, ngram, n, frequency) VALUES "
                
                var ngrams = [String]()
                var containers = [String]()
                
                // Populate the Ngrams table and Container table with words
                for word in allWords {
                    if word == "" || word == " " {
