Add some more test;
Some code modifications;