* Added some test cases (Yet to move the class to test package)
* Fixed tiny bug revealed by tests.