FIX Fixed issue with teardown. NEW added improved unit tests.