now with clamping of output values