refactor sidebar rendering