Reorganise prefs.js, and fixing the widget creation