refactor to clear up es-proxy module