revision of sample.js