Add relations, fix tests.