Modified myapi.js to support script management