Updated relations code to work with new format.