Tidied up Script API