rewrite with co and es6-promise support.