Refactoring relation handler