main: rewrite in terms of some of the new interfaces