cleaned up javascript for the sidebar
cleaned up javascript for the sidebar