Changed swsCalc function. Need to change all functions that use it.