re-wrote tdds to take advantage of symmetries.