Added functionallity to calcPrefs