small code formatting and added debug to prefs