Significant API tweaks to handle relationships.