Resolve #7
Update for #6, can's resolve it but make code better.
Resolve #8, add some UT