Updated relationship type logic