Added a callback for preference changes