Lots more refactoring and handling of relationships when fetching entries.