added subtraction of safetystock