Added unit tests for README.md use cases and fixed some bugs.