Refactoring in endpoints