lots of hacking to get the sidebar to work mostly right