updated to work with ES