Refactored relationship builder