Rewrite promise