Refactor preference editing