Add some test cases. Refactoring is done.