Added logic tests.
Reverted to original code.