Adding the test cases and the new implementation.
Merge branches 'master' and 'newimpl'