Readjust to algorithm, add extra  TestCases.