diff --git a/apps/files_versions/appinfo/app.php b/apps/files_versions/appinfo/app.php
index f28210553c2170cded7e1c2d7ea7597c39b989bd..030e8c80bff62c7405ea8e53834911dc0ef38542 100644
--- a/apps/files_versions/appinfo/app.php
+++ b/apps/files_versions/appinfo/app.php
@@ -22,4 +22,5 @@
  *
  */
 
-\OCA\Files_Versions\Hooks::connectHooks();
+\OC::$server->query(\OCA\Files_Versions\AppInfo\Application::class);
+
diff --git a/apps/files_versions/composer/composer/autoload_classmap.php b/apps/files_versions/composer/composer/autoload_classmap.php
index 40daaff2cc54dcf6bc09dda272fd48b809343f24..19f08f9927de2ce69bdb876bf19e6e2aa656c7cc 100644
--- a/apps/files_versions/composer/composer/autoload_classmap.php
+++ b/apps/files_versions/composer/composer/autoload_classmap.php
@@ -16,6 +16,8 @@ return array(
     'OCA\\Files_Versions\\Events\\CreateVersionEvent' => $baseDir . '/../lib/Events/CreateVersionEvent.php',
     'OCA\\Files_Versions\\Expiration' => $baseDir . '/../lib/Expiration.php',
     'OCA\\Files_Versions\\Hooks' => $baseDir . '/../lib/Hooks.php',
+    'OCA\\Files_Versions\\Listener\\LoadAdditionalListener' => $baseDir . '/../lib/Listener/LoadAdditionalListener.php',
+    'OCA\\Files_Versions\\Listener\\LoadSidebarListener' => $baseDir . '/../lib/Listener/LoadSidebarListener.php',
     'OCA\\Files_Versions\\Sabre\\Plugin' => $baseDir . '/../lib/Sabre/Plugin.php',
     'OCA\\Files_Versions\\Sabre\\RestoreFolder' => $baseDir . '/../lib/Sabre/RestoreFolder.php',
     'OCA\\Files_Versions\\Sabre\\RootCollection' => $baseDir . '/../lib/Sabre/RootCollection.php',
diff --git a/apps/files_versions/composer/composer/autoload_static.php b/apps/files_versions/composer/composer/autoload_static.php
index 46ed474dc31d1ccc98b12ebf798f54c3a514677c..a6fa927bc121ee969b484662c2887255cef04a32 100644
--- a/apps/files_versions/composer/composer/autoload_static.php
+++ b/apps/files_versions/composer/composer/autoload_static.php
@@ -31,6 +31,8 @@ class ComposerStaticInitFiles_Versions
         'OCA\\Files_Versions\\Events\\CreateVersionEvent' => __DIR__ . '/..' . '/../lib/Events/CreateVersionEvent.php',
         'OCA\\Files_Versions\\Expiration' => __DIR__ . '/..' . '/../lib/Expiration.php',
         'OCA\\Files_Versions\\Hooks' => __DIR__ . '/..' . '/../lib/Hooks.php',
+        'OCA\\Files_Versions\\Listener\\LoadAdditionalListener' => __DIR__ . '/..' . '/../lib/Listener/LoadAdditionalListener.php',
+        'OCA\\Files_Versions\\Listener\\LoadSidebarListener' => __DIR__ . '/..' . '/../lib/Listener/LoadSidebarListener.php',
         'OCA\\Files_Versions\\Sabre\\Plugin' => __DIR__ . '/..' . '/../lib/Sabre/Plugin.php',
         'OCA\\Files_Versions\\Sabre\\RestoreFolder' => __DIR__ . '/..' . '/../lib/Sabre/RestoreFolder.php',
         'OCA\\Files_Versions\\Sabre\\RootCollection' => __DIR__ . '/..' . '/../lib/Sabre/RootCollection.php',
diff --git a/apps/files_versions/lib/AppInfo/Application.php b/apps/files_versions/lib/AppInfo/Application.php
index 919a9b42d7979bf0346065276db028d575972766..c5791f33d3ab7d140b1d52c7a763482fe1035be7 100644
--- a/apps/files_versions/lib/AppInfo/Application.php
+++ b/apps/files_versions/lib/AppInfo/Application.php
@@ -25,24 +25,37 @@ namespace OCA\Files_Versions\AppInfo;
 
 use OCA\DAV\CalDAV\Proxy\ProxyMapper;
 use OCA\DAV\Connector\Sabre\Principal;
+use OCA\Files_Versions\Capabilities;
+use OCA\Files_Versions\Listener\LoadAdditionalListener;
+use OCA\Files_Versions\Listener\LoadSidebarListener;
 use OCA\Files_Versions\Versions\IVersionManager;
 use OCA\Files_Versions\Versions\VersionManager;
+use OCA\Files_Versions\Hooks;
+use OCA\Files\Event\LoadAdditionalScriptsEvent;
+use OCA\Files\Event\LoadSidebar;
 use OCP\AppFramework\App;
 use OCP\AppFramework\IAppContainer;
-use OCA\Files_Versions\Capabilities;
+use OCP\EventDispatcher\IEventDispatcher;
 
 class Application extends App {
-	public function __construct(array $urlParams = array()) {
-		parent::__construct('files_versions', $urlParams);
+
+	const APP_ID = 'files_versions';
+
+	public function __construct(array $urlParams = []) {
+		parent::__construct(self::APP_ID, $urlParams);
 
 		$container = $this->getContainer();
+		$server = $container->getServer();
+
+		/** @var IEventDispatcher $newDispatcher */
+		$dispatcher = $server->query(IEventDispatcher::class);
 
-		/*
+		/**
 		 * Register capabilities
 		 */
 		$container->registerCapability(Capabilities::class);
 
-		/*
+		/**
 		 * Register $principalBackend for the DAV collection
 		 */
 		$container->registerService('principalBackend', function (IAppContainer $c) {
@@ -62,6 +75,16 @@ class Application extends App {
 		});
 
 		$this->registerVersionBackends();
+
+		/**
+		 * Register Events
+		 */
+		$this->registerEvents($dispatcher);
+
+		/**
+		 * Register hooks
+		 */
+		Hooks::connectHooks();
 	}
 
 	public function registerVersionBackends() {
@@ -98,4 +121,10 @@ class Application extends App {
 			$logger->logException($e);
 		}
 	}
+
+	protected function registerEvents(IEventDispatcher $dispatcher) {
+		$dispatcher->addServiceListener(LoadAdditionalScriptsEvent::class, LoadAdditionalListener::class);
+		$dispatcher->addServiceListener(LoadSidebar::class, LoadSidebarListener::class);
+	}
+
 }
diff --git a/apps/files_versions/lib/Hooks.php b/apps/files_versions/lib/Hooks.php
index 4e2dcfa30876390eb2fc2d14f50b03a477879a2a..953bd5deca205cf66f74df46a2908b3e6b7d0349 100644
--- a/apps/files_versions/lib/Hooks.php
+++ b/apps/files_versions/lib/Hooks.php
@@ -35,28 +35,30 @@
 
 namespace OCA\Files_Versions;
 
+use OC\Files\Filesystem;
+use OC\Files\Mount\MoveableMount;
+use OC\Files\View;
+use OCP\Util;
+
 class Hooks {
 
 	public static function connectHooks() {
 		// Listen to write signals
-		\OCP\Util::connectHook('OC_Filesystem', 'write', Hooks::class, 'write_hook');
+		Util::connectHook('OC_Filesystem', 'write', Hooks::class, 'write_hook');
 		// Listen to delete and rename signals
-		\OCP\Util::connectHook('OC_Filesystem', 'post_delete', Hooks::class, 'remove_hook');
-		\OCP\Util::connectHook('OC_Filesystem', 'delete', Hooks::class, 'pre_remove_hook');
-		\OCP\Util::connectHook('OC_Filesystem', 'post_rename', Hooks::class, 'rename_hook');
-		\OCP\Util::connectHook('OC_Filesystem', 'post_copy', Hooks::class, 'copy_hook');
-		\OCP\Util::connectHook('OC_Filesystem', 'rename', Hooks::class, 'pre_renameOrCopy_hook');
-		\OCP\Util::connectHook('OC_Filesystem', 'copy', Hooks::class, 'pre_renameOrCopy_hook');
-
-		$eventDispatcher = \OC::$server->getEventDispatcher();
-		$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', [Hooks::class, 'onLoadFilesAppScripts']);
+		Util::connectHook('OC_Filesystem', 'post_delete', Hooks::class, 'remove_hook');
+		Util::connectHook('OC_Filesystem', 'delete', Hooks::class, 'pre_remove_hook');
+		Util::connectHook('OC_Filesystem', 'post_rename', Hooks::class, 'rename_hook');
+		Util::connectHook('OC_Filesystem', 'post_copy', Hooks::class, 'copy_hook');
+		Util::connectHook('OC_Filesystem', 'rename', Hooks::class, 'pre_renameOrCopy_hook');
+		Util::connectHook('OC_Filesystem', 'copy', Hooks::class, 'pre_renameOrCopy_hook');
 	}
 
 	/**
 	 * listen to write event.
 	 */
 	public static function write_hook( $params ) {
-		$path = $params[\OC\Files\Filesystem::signal_param_path];
+		$path = $params[Filesystem::signal_param_path];
 		if($path !== '') {
 			Storage::store($path);
 		}
@@ -71,7 +73,7 @@ class Hooks {
 	 * cleanup the versions directory if the actual file gets deleted
 	 */
 	public static function remove_hook($params) {
-		$path = $params[\OC\Files\Filesystem::signal_param_path];
+		$path = $params[Filesystem::signal_param_path];
 		if($path !== '') {
 			Storage::delete($path);
 		}
@@ -82,7 +84,7 @@ class Hooks {
 	 * @param array $params
 	 */
 	public static function pre_remove_hook($params) {
-		$path = $params[\OC\Files\Filesystem::signal_param_path];
+		$path = $params[Filesystem::signal_param_path];
 			if($path !== '') {
 				Storage::markDeletedFile($path);
 			}
@@ -129,26 +131,19 @@ class Hooks {
 	public static function pre_renameOrCopy_hook($params) {
 		// if we rename a movable mount point, then the versions don't have
 		// to be renamed
-		$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
-		$manager = \OC\Files\Filesystem::getMountManager();
+		$absOldPath = Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
+		$manager = Filesystem::getMountManager();
 		$mount = $manager->find($absOldPath);
 		$internalPath = $mount->getInternalPath($absOldPath);
-		if ($internalPath === '' and $mount instanceof \OC\Files\Mount\MoveableMount) {
+		if ($internalPath === '' and $mount instanceof MoveableMount) {
 			return;
 		}
 
-		$view = new \OC\Files\View(\OCP\User::getUser() . '/files');
+		$view = new View(\OCP\User::getUser() . '/files');
 		if ($view->file_exists($params['newpath'])) {
 			Storage::store($params['newpath']);
 		} else {
 			Storage::setSourcePathAndUser($params['oldpath']);
 		}
 	}
-
-	/**
-	 * Load additional scripts when the files app is visible
-	 */
-	public static function onLoadFilesAppScripts() {
-		\OCP\Util::addScript('files_versions', 'files_versions');
-	}
 }
diff --git a/apps/files_versions/lib/Listener/LoadAdditionalListener.php b/apps/files_versions/lib/Listener/LoadAdditionalListener.php
new file mode 100644
index 0000000000000000000000000000000000000000..ad08f10e46c3a926bab8e3e62e652027b847576f
--- /dev/null
+++ b/apps/files_versions/lib/Listener/LoadAdditionalListener.php
@@ -0,0 +1,45 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Files_Versions\Listener;
+
+use OCA\Files_Versions\AppInfo\Application;
+use OCA\Files\Event\LoadAdditionalScriptsEvent;
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventListener;
+use OCP\Util;
+
+class LoadAdditionalListener implements IEventListener {
+	public function handle(Event $event): void {
+		if (!($event instanceof LoadAdditionalScriptsEvent)) {
+			return;
+		}
+
+		// TODO: make sure to only include the sidebar script when 
+		// we properly split it between files list and sidebar
+		Util::addScript(Application::APP_ID, 'files_versions');
+	}
+
+}
diff --git a/apps/files_versions/lib/Listener/LoadSidebarListener.php b/apps/files_versions/lib/Listener/LoadSidebarListener.php
new file mode 100644
index 0000000000000000000000000000000000000000..37125064caf00775ed8fc8d18f9a93c4fb6b879d
--- /dev/null
+++ b/apps/files_versions/lib/Listener/LoadSidebarListener.php
@@ -0,0 +1,45 @@
+<?php
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCA\Files_Versions\Listener;
+
+use OCA\Files_Versions\AppInfo\Application;
+use OCA\Files\Event\LoadSidebar;
+use OCP\EventDispatcher\Event;
+use OCP\EventDispatcher\IEventListener;
+use OCP\Util;
+
+class LoadSidebarListener implements IEventListener {
+	public function handle(Event $event): void {
+		if (!($event instanceof LoadSidebar)) {
+			return;
+		}
+
+		// TODO: make sure to only include the sidebar script when 
+		// we properly split it between files list and sidebar
+		Util::addScript(Application::APP_ID, 'files_versions');
+	}
+
+}