 
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
 
+        // Create user defaults and load correct default preferences
         let defaults = UserDefaults.standard
         
         // Load default preferences into user defaults, in case these preference keys have not been set by user yet
         let prefsFile = Bundle.main.url(forResource: "DefaultPreferences", withExtension: "plist")!
-        let prefsDict = NSDictionary(contentsOf: prefsFile)!
-        defaults.register(defaults: prefsDict as! [String: Any])
+        let prefsDict = NSDictionary(contentsOf: prefsFile) as! [String: Any]
+        defaults.register(defaults: prefsDict)
 
         // Set the UI Theme for the saved theme key
         if let theme = UITheme(rawValue: defaults.integer(forKey: userDefaultTheme)) {

        if TARGET_OS_SIMULATOR != 0 || TARGET_IPHONE_SIMULATOR != 0 {
            print("Realm path: \(Realm.Configuration.defaultConfiguration.fileURL!)")
            // Catches all exceptions and prints
            NSSetUncaughtExceptionHandler { (exception) in
                print(exception)
            }

            // For UITesting, handle any launch options
            prepareForUITesting()
        }

        return true
    }
    

    }

    /// Handles opening app via 3D touch quick action
    func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
        switch shortcutItem.quickActionId {
        case .addNewClass:
            guard let splitNav = window?.rootViewController?.childViewControllers.first?.childViewControllers.first,
