new environment test and code cleanup