More environment code cleanup.