OT Unit Test added, and modify bugs in algorithm