                     faculty.name = dict["value"] as! String?
                     self.faculties?.append(faculty)
                     
+                    let urlString = "http://www.sfu.ca/bin/wcm/course-outlines?\(semester)\(faculty.name!)"
+                    let url = URL(string: urlString)
+                    
+                    //get JSON from API
+                    URLSession.shared.dataTask(with: url!) { (data, response, error) in
+                        //check if an error is returned form the server
+                        if error != nil {
+                            print(error!)
+                            return
+                        }
+                        
+                        //parse JSON
+                        do {
+                            let jsonData = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers)
+                            
+                            //create an array to hold the classes to be added to the hashTable
+                            var classArr = [Class]()
+                            
+                            //********** THIS LINE RANDOMLY CAUSES ERRORS ******************
+                            //sometimes gets completey or nearly through jsonData, other times breaks almost immediately
+                            for dict in jsonData as! [[String:AnyObject]]{
+                                
+                                //add each class inthe JSON data to the array
+                                let new = Class()
+                                new.number = dict["text"] as! String?
+                                classArr.append(new)
+                            }
+                            //add the array to the hashTable
+                            self.hashTable!["\(faculty.name!)"] = classArr
+                            
+                        } catch let error {
+                            print(error)
+                        }
+                        //set to true when thread parsing the JSON data is done
+                        }.resume()
+                    
                 }
                 
                 self.facultiesDone = true

            
            
            }.resume()
        
    }

    

        
        //vanquishing the slobbering beast of multi-threading issues
        while !(self.facultiesDone) {
            
            // ADD LOADING SCREEN HERE INSTEAD
            sleep(UInt32(0.1))
        }
        
        
        //getting the correct value in currentFaculty
        setCurrentFaculty(row: 0)
