         mainWindow: true
 
 
-  showOnboardingWindow: ->
-    existing = @windowWithPropsMatching({uniqueId: 'onboarding'})
-    if existing
-      existing.showWhenLoaded()
-    else
-      @newWindow
-        title: 'Welcome to Nylas'
-        frame: false
-        width: 340
-        height: 550
-        resizable: false
-        windowType: 'onboarding'
-        windowPackages: ['onboarding']
-        windowProps:
-          'uniqueId': 'onboarding'
+  ###
+  Onboarding Window
+
+  The onboarding window is a normal secondary window, but the WindowManager knows
+  how to create it itself.
+  ###
+
+  onboardingWindow: ->
+    @windowWithPropsMatching({uniqueId: 'onboarding'})
+
+  # Returns a new onboarding window
+  #
+  newOnboardingWindow: ->
+    @newWindow
+      title: 'Welcome to Nylas'
+      frame: false
+      width: 340
+      height: 550
+      resizable: false
+      windowType: 'onboarding'
+      windowPackages: ['onboarding']
+      windowProps:
+        'uniqueId': 'onboarding'
 
   # Makes a new window appear of a certain `windowType`.
   #

    else
      @_processingQueue = false

  # Public: Removes the {AtomWindow} from the global window list.
  removeWindow: (window) ->
    @_windows.splice @_windows.indexOf(window), 1

    if hasToken
      @showMainWindow()
    else
      onboarding = @onboardingWindow() ? @newOnboardingWindow()
      onboarding.showWhenLoaded()

      @closeMainWindow()
      @unregisterAllHotWindows()
      for win in @_windows
        win.close() unless win is onboarding

  windows: ->
    @_windows
