Moved relevant code to sidebarview.js