First version of new API (for #7)