simplified sample JS script
fixed #12