endpoint refactoring