Updated, added comments and some new test cases.
Updated, added comments and some new test cases.