Improve the script API