major remodeling of S_Matrix class