Thinning refactoring