Major refactor of the preference system, backported from mikoto. Now with full iOS 8 compatibility.