added a local clamp function