Refactor a bit more the preferences controller