adapting do.js for new API