refactored relation endpoint