refactored code so that the code for the sidebar is placed in layout/_sidebar.html.erb
merged code