Refactored prefs to move log specific stuff to own method. Some other tidying up.