updated technical design document. cleaned up some of the code