Improved environment resolution.