add legend and fix side panel toggle