refactored to remove hard-coded exceptions like "4, 9, 40, 90" etc but still fully functional