refactor ES for DS

Can you make sure this still works?