Fixed prefs dialog, added prefs handlers