Reverting previous commit since can be used as a lesson in missing test and wrong logic.

Revert "Amir - correcting the logic and adding more tests"

This reverts commit 2a9829a7a84d87094138ea4669463990d79315b1.