Added unit test for entry and exit flags to put the matter to rest.
Also cleaned up a few other things regarding tests.