Added S and SInverse functions.