Refactor Rel joins