Upgraded env-marks with safetly logic