simplified the sidebar code