Added debug logic to adding and removing entities.