Reduce extendSidebar lines of code