Minor cosmetic changes
Changed the implementation of the entry and exit point counting. Refactor.
Added file for unit tests.