Copied (incredibly long) loadRelationships method.
Lots of bug fixes.
More bug fixes.