Refactors the preferences panel.