[Yujun] Added more tests.
[Yujun] Refactoring.
[Yujun] Refactoring.