Refactoring segments