refactoring clipping