diff --git a/disqus.routing.yml b/disqus.routing.yml
index 4fa5479..2a96bab 100644
--- a/disqus.routing.yml
+++ b/disqus.routing.yml
@@ -9,6 +9,6 @@ disqus.settings:
 disqus.close_window:
   path: '/disqus/closewindow'
   defaults:
-    _content: '\Drupal\disqus\Controller\DisqusController::closeWindow'
+    _controller: '\Drupal\disqus\Controller\DisqusController::closeWindow'
   requirements:
     _permission: 'access content'
diff --git a/src/Controller/DisqusController.php b/src/Controller/DisqusController.php
index 49e62a7..964cd9c 100644
--- a/src/Controller/DisqusController.php
+++ b/src/Controller/DisqusController.php
@@ -1,8 +1,14 @@
 <?php

+/**
+ * @file
+ * Contains \Drupal\disqus\Controller\DisqusController.
+ */
+
 namespace Drupal\disqus\Controller;

 class DisqusController {
+
   /**
    * Menu callback; Automatically closes the window after the user logs in.
    *
@@ -10,17 +16,13 @@ class DisqusController {
    *   A render array containing the confirmation message and link that closes overlay window.
    */
   public function closeWindow() {
-     $build = array(
-       '#markup'=> t('Thank you for logging in. Please close this window, or <a href="!clickhere">click here</a> to continue.', array('!clickhere' => 'javascript:window.close();')),
-       '#attached' => array(
-         'js' => array(
-           array(
-             'type' => 'inline',
-             'data' => 'window.close();',
-           ),
-         ),
-       ),
-     );
-     return $build;
+    $build = array();
+    $build['#markup'] = t('Thank you for logging in. Please close this window, or <a href="!clickhere">click here</a> to continue.',
+      array('!clickhere' => 'javascript:window.close();'));
+    $build['#attached']['html_head'][] = array( array(
+      '#tag' => 'script',
+      '#value' => 'window.close();',
+    ), 'disqus_js');
+    return $build;
   }
 }
diff --git a/src/DisqusCommentManager.php b/src/DisqusCommentManager.php
index f8984af..cfeba1f 100644
--- a/src/DisqusCommentManager.php
+++ b/src/DisqusCommentManager.php
@@ -93,9 +93,9 @@ class DisqusCommentManager implements DisqusCommentManagerInterface {
     $disqus['sso'] = array(
       'name' => \Drupal::config('system.site')->get('name'),
       // The login window must be closed once the user logs in.
-      'url' => Url::fromRoute('user.login', array(), array('query' => array('destination' => 'disqus/closewindow'), 'absolute' => TRUE))->toString(),
+      'url' => Url::fromRoute('user.login', array(), array('query' => array('destination' => Url::fromRoute('disqus.close_window')->toString()), 'absolute' => TRUE))->toString(),
       // The logout link must redirect back to the original page.
-      'logout' => Url::fromRoute('user.logout', array(), array('query' => array('destination' => Url::fromRoute('<current>')), 'absolute' => TRUE))->toString(),
+      'logout' => Url::fromRoute('user.logout', array(), array('query' => array('destination' => Url::fromRoute('<current>')->toString()), 'absolute' => TRUE))->toString(),
       'width' => 800,
       'height' => 600,
     );
