Merge pull request #14 from Omegaice/master

 Fixed bug with S matrix being calculated incorrectly