rewrite in deferred flow style