Updated version for entity and entityreference for all instances