Improved env cleanup