Added environment variables to tune sorting