Improve the sidebar generation