Refactor clipping.