Use new API structure
Add mocha tests