ADD: preliminary design document. some questions in there, the algorithm is not complete.