refactored the filtering in the sidebar so its all in one place