Fixed some stuff with Preferences

And tidied up a bit