Refactor out panel from main