Changed from pointers to references in entities