Clean up relationship selection code.