Added function clamping