Fixed issue where tests ran multiple times
Reworking setting of environment to facilitate testing

- Issue #4