Adding clipping function