WIP: lots of work on the new API