Refactor sidebar