Model relationships and template fixes etc