Added checking to ensure units are consistent when calculating the conversion factor.
Fixed small bug in factor_dict.