More work on API (incomplete)