script implementation with shared pointers