[Yujun] Refactoring
[Yujun] Added more code.