updated to use more direct data from ES