Preferences Modular

I have spent the time to get the preferences working in an modular manner.  Lots of work.

Please have a look over the code, and suggest any style changes that you want.