simplifying clipping function