do a lot of refactoring and start on the prefs window