implemented SSD() and test_SSD(). Not sure if its right yet, and have a few TODO's scattered about.