Added sum of squares. (Not tested, but should work fine.)