refactor ES for DS

see my email for details of pending issue