refactor sidebar and related tests for dry